{"record":{"id":"ac041a93a7e19870","repo":"perspective-dev/perspective","slug":"docs-corpus-json-length-bytes-exceeds-the-do","errorCode":null,"errorMessage":"docs corpus: ${json.length} bytes exceeds the ${DOCS_RAW_BUDGET} raw budget - consider pruning the manifest","messagePattern":"docs corpus: (.+?) bytes exceeds the (.+?) raw budget - consider pruning the manifest","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/perspective-viewer/tools.mjs","lineNumber":334,"sourceCode":"    for (const file of md_files) {\n        chunks.push(...chunkMarkdown(file, fs.readFileSync(file, \"utf8\")));\n    }\n\n    for (const [file, prefix] of DOCS_DTS_FILES) {\n        if (fs.existsSync(file)) {\n            chunks.push(\n                ...chunkDts(file, fs.readFileSync(file, \"utf8\"), prefix),\n            );\n        } else {\n            console.warn(`docs corpus: ${file} missing, skipping API chunks`);\n        }\n    }\n\n    const corpus = normalizeChunks(chunks);\n    const bundle = { schemas: await buildToolSchemas(), chunks: corpus };\n    const json = JSON.stringify(bundle);\n    if (json.length > DOCS_RAW_BUDGET) {\n        console.warn(\n            `docs corpus: ${json.length} bytes exceeds the ${DOCS_RAW_BUDGET} raw budget - consider pruning the manifest`,\n        );\n    }\n\n    fs.mkdirSync(\"dist/docs\", { recursive: true });\n    fs.writeFileSync(\"dist/docs/perspective-docs.json\", json);\n    return {\n        chunks: corpus.length,\n        bytes: json.length,\n        files: md_files.length,\n    };\n}\n\n// Inline url() asset references as data URIs.\nexport function inlineUrlVisitor(fromFile) {\n    const dir = path.dirname(fromFile);\n    return composeVisitors([\n        {","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-viewer/tools.mjs#L316-L352","documentation":"Budget guard in the docs-corpus builder: the serialized corpus JSON exceeds DOCS_RAW_BUDGET bytes, so the script warns that the manifest should be pruned. Nothing fails — the oversized bundle is still emitted — but an oversized corpus bloats downstream docs/tool payloads.","triggerScenarios":"Thrown at rust/perspective-viewer/tools.mjs:334 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Prune the chunk manifest: drop stale DOCS_MD_ROOTS/DOCS_DTS_FILES entries","Tighten normalizeChunks filtering to exclude boilerplate or low-value content","Raise DOCS_RAW_BUDGET deliberately if the larger corpus is intended","Compare corpus size against the previous build to find which additions caused growth"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}