Fission-AI/OpenSpec · error

Context too large ( KB, limit: KB)

Error message

Context too large (${(contextSize / 1024).toFixed(1)}KB, limit: ${MAX_CONTEXT_SIZE / 1024}KB)

What it means

Warning from readProjectConfig: the 'context' field is a string but exceeds MAX_CONTEXT_SIZE bytes. It is immediately followed by the 'Ignoring context field' warning; the oversized context is dropped and the config loads without it.

Solutions

  1. Trim the context text below the size limit shown in the message
  2. Move large shared context into a file the workflow references instead
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/core/project-config.ts:301 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/ccd931d8974cbb3f. Report an issue: GitHub.

Appendix: source

Thrown at src/core/project-config.ts:301

    // Parse schema field using Zod
    const schemaField = z.string().min(1);
    const schemaResult = schemaField.safeParse(raw.schema);
    if (schemaResult.success) {
      config.schema = schemaResult.data;
    } else if (raw.schema !== undefined) {
      console.warn(`Invalid 'schema' field in config (must be non-empty string)`);
    }

    // Parse context field with size limit
    if (raw.context !== undefined) {
      const contextField = z.string();
      const contextResult = contextField.safeParse(raw.context);

      if (contextResult.success) {
        const contextSize = Buffer.byteLength(contextResult.data, 'utf-8');
        if (contextSize > MAX_CONTEXT_SIZE) {
          console.warn(
            `Context too large (${(contextSize / 1024).toFixed(1)}KB, limit: ${MAX_CONTEXT_SIZE / 1024}KB)`
          );
          console.warn(`Ignoring context field`);
        } else {
          config.context = contextResult.data;
        }
      } else {
        console.warn(`Invalid 'context' field in config (must be string)`);
      }
    }

    // Parse rules field using Zod
    if (raw.rules !== undefined) {
      const rulesField = z.record(z.string(), z.array(z.string()));

      // First check if it's an object structure (guard against null since typeof null === 'object')
      if (typeof raw.rules === 'object' && raw.rules !== null && !Array.isArray(raw.rules)) {
        // Artifact ids are intentionally not restricted to the built-in naming

View on GitHub (pinned to 6926ccb18a)