can1357/oh-my-pi · error · ToolError
Unknown attachment URL in bash command: ${url}
Error message
Unknown attachment URL in bash command: ${url} What it means
For 'attachment://' URLs, resolveInternalUrlToPath looks up the URI in the session's known attachment list. If no entry's uri matches the requested URL, it throws this ToolError because the attachment does not exist in the current session and there is no sourcePath to resolve to.
Source
Thrown at packages/coding-agent/src/tools/bash-skill-urls.ts:277
localOptions?: LocalProtocolOptions,
ensureLocalParentDirs?: boolean,
cwd?: string,
sessionFile?: string,
): Promise<string> {
const url = normalizeLocalScheme(rawUrl);
const scheme = extractScheme(url);
if (!scheme) {
throw new ToolError(`Unsupported internal URL in bash command: ${url}`);
}
if (scheme === "skill") {
return resolveSkillUrlToPath(url, skills);
}
if (scheme === "attachment") {
const attachment = attachments.find(entry => entry.uri === url);
if (!attachment) {
throw new ToolError(`Unknown attachment URL in bash command: ${url}`);
}
return path.resolve(attachment.sourcePath);
}
if (scheme === "local") {
if (!localOptions) {
throw new ToolError(
"Cannot resolve local:// URL in bash command: local protocol options are unavailable for this session.",
);
}
const resolvedLocalPath = resolveLocalUrlToPath(url, localOptions);
if (ensureLocalParentDirs) {
await fs.mkdir(path.dirname(resolvedLocalPath), { recursive: true });
}
return resolvedLocalPath;
}
if (!internalRouter?.canHandle(url)) {View on GitHub (pinned to 9690622007)
Solutions
- List the session's current attachments and copy the exact attachment:// URI from there.
- Verify the command runs in the same session where the attachment was created.
- Fix typos or normalization differences in the URI (compare byte-for-byte against the registered entry.uri).
- Pass the file's source path directly instead of the attachment URL if you know it.
Example fix
// before const cmd = `wc -c attachment://img-0042.png`; // not registered // after const cmd = `wc -c attachment://8f3a.../screenshot.png`; // exact URI from session attachments
Defensive patterns
Strategy: validation
Validate before calling
const known = new Set(attachments.map(a => a.uri));
if (!known.has(url)) throw new Error(`Attachment not in session: ${url}`); Try / catch
try { await expandInternalUrls(cmd, ctx); } catch (e) { if (e instanceof ToolError && e.message.includes('Unknown attachment URL')) { /* list valid attachments and retry with correct URI */ } else throw e; } Prevention
- Copy attachment:// URIs exactly from the session's attachment list output.
- Don't reuse attachment URIs across sessions; they are session-scoped.
- Verify the attachment actually loaded before referencing it.
When it happens
Trigger: A bash command references attachment://<uri> but the uri is not among the ImageAttachmentEntry values captured for the session — the attachment was never added, was added in a different session, or the URI string differs (trailing slash, different id, typo).
Common situations: Referencing an attachment from a previous session or another agent run; hand-typing the attachment URI with the wrong id; an attachment that failed to load so it was never registered.
Related errors
- %%bash requires a POSIX bash, but none was found. Install Gi
- Command exited with code ${result.exitCode}
- Command aborted
- Command timed out after ${err.message.slice("timeout:".lengt
- Unsupported internal URL in bash command: ${url}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/01fb90144c2c8b98.
Report an issue: GitHub.