Fission-AI/OpenSpec · error

Ignoring context field

Error message

Ignoring context field

What it means

Companion warning from readProjectConfig confirming that an oversized 'context' field was discarded rather than truncated. It always follows the 'Context too large' warning and means prompts will run without the project context block.

Solutions

  1. Shrink the context field under the limit so it is honored
  2. Split context into per-operation guidance entries if it is inherently large
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/core/project-config.ts:304 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/b8526b5d4386b2bc. Report an issue: GitHub.

Appendix: source

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

    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
        // convention, so keys such as "constructor" remain valid for custom
        // schemas. A null-prototype map preserves those keys as data without
        // letting "__proto__" mutate the lookup object's prototype.

View on GitHub (pinned to 6926ccb18a)