[Bug] Code Porting Fails: Ignores Existing Implementation Details

Resolved 💬 3 comments Opened Sep 23, 2025 by istorrs Closed Jan 10, 2026

Bug Description
Many times now, I have asked Claude to read an existing code base (could be a very small code base or a large with details of which files to read) containing an implementation and asked it to port it to a different API or replicate the exact logic in a new module. And invariably, Claude Code has failed completely. This seems like an easy task. Take some existing code and refactor it to a new code base. For instance, I have an embedded RUST application running on RPI. It implemements a bit banged UART over GPIO. The UART is completely abstracted, working on just a sequence of bits. no knowledge of the underlying GPIO bit banging. I asked Claude Code to port this to a NRF Embassy framework. I explained that this meant preserving the UART logic and replacing the RPI GPIO with NRF Embassy GPIO and replacing threads with Embassy timers and tasks. Yet, when Claude performed the port, it not only re-wrote the GPIO layer, it completely re-wrote the UART layer and completely broke it. It did not tell me it had done so, and I naively trusted it to have followed the plan. Many hours of debugging later, I discovered the issue. I asked Claude to re-read the original RPI Uart library. It did not even try to read it. It responded with "The RPI UART library likely does x and y and z ...." - How can it so fundamentally fail to follow instructions? Why would it not read the code to be ported rather than guessing what that code would do? This is the fundamental flaw in Claude Code. It does not adhere to the agreed plan, it does not even follow instructions added to Claude.MD. Why can it not do what is asked and agreed?

Environment Info

  • Platform: linux
  • Terminal: gnome-terminal
  • Version: 1.0.115
  • Feedback ID: d032af3a-bda8-401c-8618-e368f1cf1bba

Errors

[{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at mV (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:1184)\n    at file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:912\n    at Array.map (<anonymous>)\n    at EX (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:903)\n    at uHB (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:3025:9380)\n    at rD (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:84:19415)\n    at ll (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:42814)\n    at I9 (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:38355)\n    at sf (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:38283)\n    at WC (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:38137)","timestamp":"2025-09-16T13:52:04.740Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at mV (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:1184)\n    at file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:912\n    at Array.map (<anonymous>)\n    at EX (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:903)\n    at uHB (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:3025:9380)\n    at rD (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:84:19415)\n    at ll (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:42814)\n    at I9 (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:38355)\n    at sf (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:38283)\n    at WC (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:38137)","timestamp":"2025-09-16T13:52:04.748Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at mV (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:1184)\n    at file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:912\n    at Array.map (<anonymous>)\n    at EX (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1769:903)\n    at uHB (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:3025:9380)\n    at rD (file:///home/rtp-lab/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/cl

Note: Error logs were truncated.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗