{"record":{"id":"52ebcb9c40d1caaf","repo":"can1357/oh-my-pi","slug":"artifact-artifact-id-is-artifact-size-bytes","errorCode":null,"errorMessage":"Artifact ${artifact.id} is ${artifact.size} bytes; full internal resolution is blocked. Use read selectors such as artifact://${artifact.id}:1-3000 or artifact://${artifact.id}:raw:1-3000, and use the artifact file path for search/copy workflows: ${artifact.path}","messagePattern":"Artifact (.+?) is (.+?) bytes; full internal resolution is blocked\\. Use read selectors such as artifact://(.+?):1-3000 or artifact://(.+?):raw:1-3000, and use the artifact file path for search/copy workflows: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/internal-urls/artifact-protocol.ts","lineNumber":119,"sourceCode":"\n\tasync resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource> {\n\t\tconst artifact = await resolveArtifactFile(url, context);\n\n\t\t// Path-only callers (search/grep, bash URL expansion) never touch the\n\t\t// artifact bytes. Return the resource shape so those flows keep working\n\t\t// on artifacts of any size — only content materialization is gated.\n\t\tif (context?.pathOnly) {\n\t\t\treturn {\n\t\t\t\turl: url.href,\n\t\t\t\tcontent: \"\",\n\t\t\t\tcontentType: \"text/plain\",\n\t\t\t\tsize: artifact.size,\n\t\t\t\tsourcePath: artifact.path,\n\t\t\t};\n\t\t}\n\n\t\tif (artifact.size > MAX_INLINE_ARTIFACT_BYTES) {\n\t\t\tthrow new Error(\n\t\t\t\t`Artifact ${artifact.id} is ${artifact.size} bytes; full internal resolution is blocked. Use read selectors such as artifact://${artifact.id}:1-3000 or artifact://${artifact.id}:raw:1-3000, and use the artifact file path for search/copy workflows: ${artifact.path}`,\n\t\t\t);\n\t\t}\n\n\t\tconst content = await Bun.file(artifact.path).text();\n\t\treturn {\n\t\t\turl: url.href,\n\t\t\tcontent,\n\t\t\tcontentType: \"text/plain\",\n\t\t\tsize: artifact.size,\n\t\t\tsourcePath: artifact.path,\n\t\t};\n\t}\n\n\tasync complete(): Promise<UrlCompletion[]> {\n\t\tconst ids = new Set<string>();\n\t\tfor (const dir of artifactsDirsFromRegistry()) {\n\t\t\tlet files: string[];","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/internal-urls/artifact-protocol.ts#L101-L137","documentation":"Full-text resolution of an artifact through artifact:// is capped at MAX_INLINE_ARTIFACT_BYTES. Larger artifacts are refused so a single read doesn't dump megabytes of tool output into the model context; the error tells you to use line/range selectors or the on-disk path for bulk operations.","triggerScenarios":"Calling artifact://<id> (no selector) or a selector that resolves the full body when the artifact's stat().size exceeds MAX_INLINE_ARTIFACT_BYTES.","commonSituations":"Reading a large build log, test output, or generated dump artifact in full; agent tried to ingest a big command-output artifact wholesale instead of slicing it.","solutions":["Read a slice with a selector: artifact://<id>:1-3000","Use raw byte ranges: artifact://<id>:raw:1-3000","For search/copy/paging workflows, operate on artifact.path directly with grep/read tools","Iterate ranges (1-3000, 3001-6000, ...) if you truly need the whole content"],"exampleFix":"// before\nconst all = await resolve('artifact://17')\n// after\nconst first = await resolve('artifact://17:1-3000')\nconst rest  = await resolve('artifact://17:raw:3001-6000')","handlingStrategy":"validation","validationCode":"const MAX = 256 * 1024 // match MAX_INLINE_ARTIFACT_BYTES\nconst size = (await Bun.file(artifactPath).stat()).size\nconst url = size > MAX ? `artifact://${id}:1-3000` : `artifact://${id}`","typeGuard":null,"tryCatchPattern":"try {\n  return await resolve(`artifact://${id}`)\n} catch (err) {\n  if (String(err).includes('full internal resolution is blocked')) {\n    return resolve(`artifact://${id}:1-3000`)\n  }\n  throw err\n}","preventionTips":["Always prefer range selectors (artifact://id:1-3000) for unknown-size artifacts","Use the artifact file path with grep/head for bulk inspection","Never resolve full artifacts inline into model context without checking size"],"tags":["artifact","size-limit","context-overflow"],"backgroundTag":"payload-too-large","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}