claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

"Image Read Tool Failure: 'B is not a function' Error"

Open jward7 opened this issue 7 months ago • 6 comments

Bug Description An issue with the image read tool. "Error: B is not a function". Claude code, MacOS taking a screenshot. Claude code in the terminal. Tried making the image smaller and also converting from png to jpg. None of these strategies worked.

Environment Info

  • Platform: macos
  • Terminal: tmux
  • Version: 1.0.3
  • Feedback ID: 8bf5674e-dd02-4ab1-b4cd-0db80084fddd

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at cG (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:644:3513)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:15313\n    at Q (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:532:13335)\n    at sR1 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:14562)\n    at aI (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:14179)\n    at FU2 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1965:20997)","timestamp":"2025-05-26T13:28:15.397Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/jward/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:540:1519)\n    at UD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1318:16584)\n    at Da (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2580)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:11384\n    at b7 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:21374)\n    at hZ (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:40861)\n    at wW (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:34915)\n    at W5 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:148:4822)\n    at $8 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:32232)","timestamp":"2025-05-26T13:28:15.691Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/jward/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:540:1519)\n    at UD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1318:16584)\n    at QS4 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:555)\n    at HD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2305)\n    at TD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:5754)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2438:2017\n    at b7 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:21374)\n    at hZ (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:40861)\n    at wW (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:34915)","timestamp":"2025-05-26T13:28:15.734Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/jward/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:540:1519)\n    at UD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1318:16584)\n    at Da (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2580)\n    at HD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2372)","timestamp":"2025-05-26T13:28:16.067Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/jward/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:540:1519)\n    at UD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1318:16584)\n    at Da (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2580)\n    at HD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2372)","timestamp":"2025-05-26T13:28:17.155Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/jward/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:540:1519)\n    at UD0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1318:16584)\n    at Da (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.j

Note: Error logs were truncated.

jward7 avatar May 26 '25 13:05 jward7

Just got the same error

clarknoah avatar May 29 '25 07:05 clarknoah

same...seems like it has to do with git versioning -- image read was working fine until i made my first commits.

mintmcqueen avatar May 29 '25 18:05 mintmcqueen

I've been stuck on this for at least a week. If I convert an image to a grayscale gif it works. Very kludgy, though.

markbastian avatar May 30 '25 17:05 markbastian

Thanks for the report, everyone. I will look into it and report back if I find a fix.

dicksontsai avatar May 30 '25 23:05 dicksontsai

FWIW i'm getting this same error on an Ubuntu 25.04 Arm VM running on an M1 Mac.

Interestingly making the image file size smaller seems to work. I had claude code try converting to grayscale as well as reduce the resolution and found the following:

Image

as a work around i've just added a preprocessing step that compresses images before claude code reads them

Peddle avatar May 31 '25 23:05 Peddle

This turns out to be a dependency/platform issue. I have a fix that I am aiming to deploy in the next release or release after. In the meantime, you can indeed avoid this issue by compressing your images before Claude Code reads them, though I understand if it is very inconvenient.

dicksontsai avatar Jun 02 '25 09:06 dicksontsai

Please update to v1.0.8, which addresses this issue.

dicksontsai avatar Jun 02 '25 18:06 dicksontsai

@dicksontsai iam on 1.0.30 (Claude Code). still getting the same error.

Image

Vasanth-070 avatar Jun 19 '25 17:06 Vasanth-070

@Vasanth-070 which platform are you using? Did you install through npm or some other way?

dicksontsai avatar Jun 20 '25 08:06 dicksontsai

Hi thanks for the reply. Iam using mac os 15.5. i have installed claude code via npm.

On Fri, 20 Jun, 2025, 13:58 Dickson Tsai, @.***> wrote:

dicksontsai left a comment (anthropics/claude-code#1334) https://github.com/anthropics/claude-code/issues/1334#issuecomment-2990257908

@Vasanth-070 https://github.com/Vasanth-070 which platform are you using? Did you install through npm or some other way?

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/1334#issuecomment-2990257908, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBFX2VGBLIYV5WNOAASRDL3EPA3JAVCNFSM6AAAAAB55WCWWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOJQGI2TOOJQHA . You are receiving this because you were mentioned.Message ID: @.***>

Vasanth-070 avatar Jun 20 '25 11:06 Vasanth-070

Hi, same issue here. I'm running Claude code v1.0.31 on WSL: 2.5.9.0. Getting the same error when pasting an image to the console:

Error: (B.default || B) is not a function

RubenAlonzo avatar Jun 23 '25 18:06 RubenAlonzo

I ran into the same bug. Just to share — it looks like when you drag and drop an image directly from Finder (or another file manager) into the terminal, the image gets recognized correctly. This seems to work.

As a side note, it doesn’t work if you’re using the VS Code extension — drag and drop doesn’t seem to be supported there.

Also, when passing an image path directly, I get the same error as before. I’m not entirely sure how it works internally, but manually dropping the image seems to let it read the data correctly.

Hope this helps as a temporary workaround.

KiichiSugihara avatar Jun 24 '25 23:06 KiichiSugihara

@dicksontsai got the same error in 1.0.38 (Claude Code) on WSL: 2.5.9.0. Installed via npm.

SpaceDandy13 avatar Jul 01 '25 02:07 SpaceDandy13

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 10 '25 14:08 github-actions[bot]