perspective-dev/perspective · error

docs corpus: bytes exceeds the raw budget - consider…

Error message

docs corpus: ${json.length} bytes exceeds the ${DOCS_RAW_BUDGET} raw budget - consider pruning the manifest

What it means

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.

Solutions

  1. Prune the chunk manifest: drop stale DOCS_MD_ROOTS/DOCS_DTS_FILES entries
  2. Tighten normalizeChunks filtering to exclude boilerplate or low-value content
  3. Raise DOCS_RAW_BUDGET deliberately if the larger corpus is intended
  4. Compare corpus size against the previous build to find which additions caused growth
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at rust/perspective-viewer/tools.mjs:334 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of perspective-dev/perspective@11c8238c0c (2026-09-09). Data as JSON: /api/errors/ac041a93a7e19870. Report an issue: GitHub.

Appendix: source

Thrown at rust/perspective-viewer/tools.mjs:334

    for (const file of md_files) {
        chunks.push(...chunkMarkdown(file, fs.readFileSync(file, "utf8")));
    }

    for (const [file, prefix] of DOCS_DTS_FILES) {
        if (fs.existsSync(file)) {
            chunks.push(
                ...chunkDts(file, fs.readFileSync(file, "utf8"), prefix),
            );
        } else {
            console.warn(`docs corpus: ${file} missing, skipping API chunks`);
        }
    }

    const corpus = normalizeChunks(chunks);
    const bundle = { schemas: await buildToolSchemas(), chunks: corpus };
    const json = JSON.stringify(bundle);
    if (json.length > DOCS_RAW_BUDGET) {
        console.warn(
            `docs corpus: ${json.length} bytes exceeds the ${DOCS_RAW_BUDGET} raw budget - consider pruning the manifest`,
        );
    }

    fs.mkdirSync("dist/docs", { recursive: true });
    fs.writeFileSync("dist/docs/perspective-docs.json", json);
    return {
        chunks: corpus.length,
        bytes: json.length,
        files: md_files.length,
    };
}

// Inline url() asset references as data URIs.
export function inlineUrlVisitor(fromFile) {
    const dir = path.dirname(fromFile);
    return composeVisitors([
        {

View on GitHub (pinned to 11c8238c0c)