openclaw - ✅(Solved) Fix [Bug]: 2026.4.9 ships without required qa/scenarios/ scaffold — breaks CLI startup and completion cache [2 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63727Fetched 2026-04-10 03:42:02
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
commented ×2cross-referenced ×1mentioned ×1referenced ×1

After updating to 2026.4.9, the CLI crashes on any command that imports the QA scenario module (including the completion cache builder). The qa/scenarios/ directory and its required files are not included in the published npm package, but the code unconditionally loads them at module top-level.

Error Message

[openclaw] Failed to start CLI: Error: qa scenario pack not found: qa/scenarios/index.md at readQaScenarioPack (suite-BW4kSK9C.js:754)

Root Cause

Three code paths in suite-BW4kSK9C.js create the failure chain:

  1. readQaScenarioPack() (line 752) reads qa/scenarios/index.md and throws if the file is empty or absent.
  2. readQaScenarioById("source-docs-discovery-report") (line 790) throws if that scenario ID is not found in the pack.
  3. readRequiredDiscoveryRefs() (line 2833) calls readQaScenarioById and is invoked at module top-level (line 2840), so the error fires on every CLI invocation that imports the module — including the completion cache builder during openclaw update.

resolveRepoPath() (line 713) walks up from import.meta.dirname looking for these files relative to each parent directory. Since the npm/Homebrew package does not include a qa/ directory anywhere in the tree, the lookup always fails.

Fix Action

Workaround

Create two files in <install_root>/qa/scenarios/:

index.md:

# QA Scenario Pack

\`\`\`yaml qa-pack
version: 1
kickoffTask: "Run all registered QA scenarios"
\`\`\`

source-docs-discovery-report.md:

# Source Docs Discovery Report

\`\`\`yaml qa-scenario
id: source-docs-discovery-report
title: Source Docs Discovery Report
surface: cli
objective: Verify the agent can discover and read required source documentation files
successCriteria:
  - Agent reads all required source files
execution:
  kind: flow
  config:
    requiredFiles:
      - repo/qa/scenarios/index.md
      - repo/extensions/qa-lab/src/suite.ts
      - repo/docs/help/testing.md
\`\`\`

\`\`\`yaml qa-flow
steps:
  - name: discover source docs
    actions:
      - assert: "true"
\`\`\`

These files will be overwritten on the next update.

PR fix notes

PR #63744: fix(cli): gracefully handle missing qa/scenarios scaffold

Description (problem / solution / changelog)

Summary

Fixes a startup crash in openclaw qa and openclaw update commands that was introduced in the 2026.4.9 release (commit a5f32d3a1a).

Root Cause

The discovery-eval.ts module calls readRequiredDiscoveryRefs() at module top-level:

const REQUIRED_DISCOVERY_REFS = readRequiredDiscoveryRefs();

This function calls readQaScenarioExecutionConfig()readQaScenarioById()readQaScenarioPack(), which reads qa/scenarios/index.md. Since this file is not included in the npm/Homebrew package, the call throws on every CLI invocation that imports the module — including the completion cache builder during openclaw update.

Fix

Wrap the top-level call in a try/catch that degrades to the hardcoded fallback (the same default paths that readRequiredDiscoveryRefs() would return if the config were present).

Before:

const REQUIRED_DISCOVERY_REFS = readRequiredDiscoveryRefs();

After:

const FALLBACK_DISCOVERY_REFS = [
  "repo/qa/scenarios/index.md",
  "repo/extensions/qa-lab/src/suite.ts",
  "repo/docs/help/testing.md",
] as const;

let REQUIRED_DISCOVERY_REFS: readonly string[];
try {
  REQUIRED_DISCOVERY_REFS = readRequiredDiscoveryRefs();
} catch {
  REQUIRED_DISCOVERY_REFS = FALLBACK_DISCOVERY_REFS;
}

Impact

  • openclaw qa subcommands are no longer broken for npm/Homebrew installs
  • openclaw update completion cache no longer crashes
  • Non-QA commands unaffected
  • Fallback maintains same discovery-ref behavior when scaffold IS present

Fix #63727

Changed files

  • extensions/qa-lab/src/discovery-eval.ts (modified, +14/-1)

PR #65162: fix(qa-lab): add try/catch around required discovery refs to prevent CLI crash

Description (problem / solution / changelog)

Closes #63727

Changed files

  • extensions/memory-core/src/dreaming-narrative.ts (modified, +2/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +34/-0)
  • src/agents/pi-embedded-runner/run/incomplete-turn.ts (modified, +1/-2)
  • src/auto-reply/reply/delivery-fallback.ts (added, +51/-0)
  • src/gateway/server-methods/chat.directive-tags.test.ts (modified, +31/-0)
  • src/gateway/server-methods/chat.ts (modified, +3/-0)
  • src/hooks/gmail-watcher.ts (modified, +13/-2)
  • src/plugin-sdk/delivery-fallback.ts (added, +8/-0)
  • src/secrets/resolve.test.ts (modified, +16/-0)
  • src/secrets/resolve.ts (modified, +9/-1)

Code Example

[openclaw] Failed to start CLI: Error: qa scenario pack not found: qa/scenarios/index.md
    at readQaScenarioPack (suite-BW4kSK9C.js:754)

---

[openclaw] Failed to start CLI: Error: unknown qa scenario: source-docs-discovery-report
    at readQaScenarioById (suite-BW4kSK9C.js:791)

---

# QA Scenario Pack

\`\`\`yaml qa-pack
version: 1
kickoffTask: "Run all registered QA scenarios"
\`\`\`

---

# Source Docs Discovery Report

\`\`\`yaml qa-scenario
id: source-docs-discovery-report
title: Source Docs Discovery Report
surface: cli
objective: Verify the agent can discover and read required source documentation files
successCriteria:
  - Agent reads all required source files
execution:
  kind: flow
  config:
    requiredFiles:
      - repo/qa/scenarios/index.md
      - repo/extensions/qa-lab/src/suite.ts
      - repo/docs/help/testing.md
\`\`\`

\`\`\`yaml qa-flow
steps:
  - name: discover source docs
    actions:
      - assert: "true"
\`\`\`
RAW_BUFFERClick to expand / collapse

Bug type

Crash / fatal error on startup

Summary

After updating to 2026.4.9, the CLI crashes on any command that imports the QA scenario module (including the completion cache builder). The qa/scenarios/ directory and its required files are not included in the published npm package, but the code unconditionally loads them at module top-level.

Steps to reproduce

  1. Install or update to OpenClaw 2026.4.9 via Homebrew or npm
  2. Run openclaw qa --help

Expected behavior

Help output is displayed.

Actual behavior

Two sequential crashes:

Crash 1 — missing pack index:

[openclaw] Failed to start CLI: Error: qa scenario pack not found: qa/scenarios/index.md
    at readQaScenarioPack (suite-BW4kSK9C.js:754)

Crash 2 (after manually creating index.md) — missing required scenario:

[openclaw] Failed to start CLI: Error: unknown qa scenario: source-docs-discovery-report
    at readQaScenarioById (suite-BW4kSK9C.js:791)

Root cause

Three code paths in suite-BW4kSK9C.js create the failure chain:

  1. readQaScenarioPack() (line 752) reads qa/scenarios/index.md and throws if the file is empty or absent.
  2. readQaScenarioById("source-docs-discovery-report") (line 790) throws if that scenario ID is not found in the pack.
  3. readRequiredDiscoveryRefs() (line 2833) calls readQaScenarioById and is invoked at module top-level (line 2840), so the error fires on every CLI invocation that imports the module — including the completion cache builder during openclaw update.

resolveRepoPath() (line 713) walks up from import.meta.dirname looking for these files relative to each parent directory. Since the npm/Homebrew package does not include a qa/ directory anywhere in the tree, the lookup always fails.

Impact

  • openclaw qa and all subcommands are completely broken (exit code 1).
  • Completion cache update fails on every openclaw update, leaving shell completions stale.
  • Core non-QA commands are unaffected.

OpenClaw version

2026.4.9 (0512059)

Operating system

macOS (Homebrew)

Install method

Homebrew (/opt/homebrew/lib/node_modules/openclaw)

Workaround

Create two files in <install_root>/qa/scenarios/:

index.md:

# QA Scenario Pack

\`\`\`yaml qa-pack
version: 1
kickoffTask: "Run all registered QA scenarios"
\`\`\`

source-docs-discovery-report.md:

# Source Docs Discovery Report

\`\`\`yaml qa-scenario
id: source-docs-discovery-report
title: Source Docs Discovery Report
surface: cli
objective: Verify the agent can discover and read required source documentation files
successCriteria:
  - Agent reads all required source files
execution:
  kind: flow
  config:
    requiredFiles:
      - repo/qa/scenarios/index.md
      - repo/extensions/qa-lab/src/suite.ts
      - repo/docs/help/testing.md
\`\`\`

\`\`\`yaml qa-flow
steps:
  - name: discover source docs
    actions:
      - assert: "true"
\`\`\`

These files will be overwritten on the next update.

Suggested fix

Either:

  1. Include qa/scenarios/ with its scaffold files in the published package, or
  2. Guard the top-level readRequiredDiscoveryRefs() call (line 2840) with a try/catch so it degrades to the hardcoded defaults (line 2834) when the scaffold is absent — the fallback array already exists but is never reached because readQaScenarioById throws first.

extent analysis

TL;DR

To fix the crash, either include the qa/scenarios/ directory in the published package or guard the readRequiredDiscoveryRefs() call with a try/catch to degrade to hardcoded defaults when the scaffold is absent.

Guidance

  • Verify that the qa/scenarios/ directory is not included in the published npm package by checking the package contents.
  • Consider including the required files in the package or implementing a try/catch block to handle the absence of these files.
  • To mitigate the issue temporarily, create the index.md and source-docs-discovery-report.md files in the <install_root>/qa/scenarios/ directory as described in the workaround section.
  • Review the code paths in suite-BW4kSK9C.js to ensure that the fix addresses the root cause of the failure chain.

Example

No code snippet is provided as the issue does not require a new code implementation, but rather a fix to the existing code or package structure.

Notes

The suggested fix has two possible approaches, and the choice between them depends on the project's requirements and constraints. Including the qa/scenarios/ directory in the package may be more straightforward, but guarding the readRequiredDiscoveryRefs() call with a try/catch provides a more robust solution that can handle different scenarios.

Recommendation

Apply the workaround by creating the required files in the <install_root>/qa/scenarios/ directory, as this provides a temporary solution until a more permanent fix can be implemented. This approach allows for the completion cache update to succeed and shell completions to remain up-to-date.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Help output is displayed.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING