can1357/oh-my-pi · error · ToolError

No image attachments are available in this turn. path="${opt

Error message

No image attachments are available in this turn. path="${options.path}" must be a readable file path or attachment URI.

What it means

The inspect-image tool's loadAttachmentReferenceInput resolves a path-like reference to an image attachment from the current turn. When the reference index points past the attachment list and the list is entirely empty, there is nothing to resolve, so a ToolError is thrown telling the caller the path must be a real file path or attachment URI instead.

Source

Thrown at packages/coding-agent/src/tools/inspect-image.ts:79

}

function formatAvailableImageAttachments(attachments: readonly { label: string; uri: string }[]): string {
	if (attachments.length === 0) return "none";
	return attachments.map(attachment => `${attachment.label} -> ${attachment.uri}`).join(", ");
}

async function loadAttachmentReferenceInput(options: {
	path: string;
	reference: ImageAttachmentReference;
	attachments: readonly { label: string; uri: string; image: ImageContent }[];
	autoResize: boolean;
	excludeWebP: boolean | undefined;
}): Promise<LoadedImageInput | null> {
	const attachment = options.attachments[options.reference.index - 1];
	if (!attachment) {
		const available = formatAvailableImageAttachments(options.attachments);
		if (options.attachments.length === 0) {
			throw new ToolError(
				`No image attachments are available in this turn. path="${options.path}" must be a readable file path or attachment URI.`,
			);
		}
		throw new ToolError(
			`Could not resolve image attachment '${options.path}'. Available image attachments: ${available}. Pass an attachment URI or a readable filesystem path.`,
		);
	}
	return loadImageAttachmentInput({
		image: attachment.image,
		label: attachment.label,
		uri: attachment.uri,
		autoResize: options.autoResize,
		maxBytes: MAX_IMAGE_INPUT_BYTES,
		excludeWebP: options.excludeWebP,
	});
}

export interface InspectImageToolDetails {

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass a real filesystem path to the image file instead of an attachment reference.
  2. Re-generate or re-load the image in the current turn so it becomes an attachment, then reference it.
  3. Check available image attachments this turn before referencing (the sibling error 2519 lists them when non-empty).
  4. If the image came from an earlier turn, find its saved output path on disk and use that.

Example fix

// before
inspect_image({ path: "attachment://1" }) // no attachments this turn
// after
inspect_image({ path: "/tmp/omp/output/chart.png" })
Defensive patterns

Strategy: validation

Validate before calling

const isAttachmentUri = (p: string) => p.startsWith('attachment://');
if (isAttachmentUri(params.path) && currentTurnAttachments.length === 0) {
  throw new Error('No attachments this turn; pass a filesystem path to the image instead');
}
if (!isAttachmentUri(params.path) && !fs.existsSync(params.path)) {
  throw new Error(`Path not found: ${params.path}`);
}

Try / catch

try {
  return await inspectImage({ path });
} catch (err) {
  if (err instanceof ToolError && err.message.includes('No image attachments')) {
    // fall back to filesystem path or regenerate the image this turn
  } else throw err;
}

Prevention

When it happens

Trigger: Calling inspect-image with path referencing an attachment (e.g. attachment index syntax) while options.attachments is empty for the current turn, at inspect-image.ts:79. Raised from execute via loadAttachmentReferenceInput.

Common situations: Agent tries to inspect an image from a previous conversation turn (attachments are per-turn); referencing an attachment before any image tool produced output this turn; stale attachment index after context compaction.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/b63ff15262e4b2ce. Report an issue: GitHub.