Fission-AI/OpenSpec · error

Rules for ' ' must be an array of strings, ignoring this…

Error message

Rules for '${artifactId}' must be an array of strings, ignoring this artifact's rules

What it means

Warning from readProjectConfig: rules.<artifactId> failed the z.array(z.string()) check (not an array of strings). That artifact's rules are skipped entirely (hasValidRules stays false for it), while other artifacts' rules still load; input at fault is the malformed rules entry.

Solutions

  1. Write rules as a YAML list of strings under the artifact id
  2. Remove malformed rule entries
Defensive patterns

Strategy: fallback

When it happens

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

Appendix: source

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

        let hasValidRules = false;

        for (const [artifactId, rules] of Object.entries(raw.rules)) {
          const rulesArrayResult = z.array(z.string()).safeParse(rules);

          if (rulesArrayResult.success) {
            // Filter out empty strings
            const validRules = rulesArrayResult.data.filter((r) => r.length > 0);
            if (validRules.length > 0) {
              parsedRules[artifactId] = validRules;
              hasValidRules = true;
            }
            if (validRules.length < rulesArrayResult.data.length) {
              console.warn(
                `Some rules for '${artifactId}' are empty strings, ignoring them`
              );
            }
          } else {
            console.warn(
              `Rules for '${artifactId}' must be an array of strings, ignoring this artifact's rules`
            );
          }
        }

        if (hasValidRules) {
          config.rules = parsedRules;
        }
      } else {
        console.warn(`Invalid 'rules' field in config (must be object)`);
      }
    }

    const operations = parseOperations(raw.operations);
    if (operations) {
      config.operations = operations;
    }

View on GitHub (pinned to 6926ccb18a)