#claude-cli not working. Need help. v2026.4.21

1 messages · Page 1 of 1 (latest)

dark marten
#

15:55:56 [agent/cli-backend] cli exec: provider=claude-cli model=sonnet promptChars=143
15:55:56 [process/supervisor] spawn failed: runId=fe6e3f0e-0af5-4f0c-9568-e76780a94a1d reason=Error: spawn ENAMETOOLONG

Setup

OpenClaw on Windows
Config: ~/.openclaw/openclaw.json
Goal

Make agents.defaults.cliBackends["claude-cli"].systemPromptWhen = "never" persist and work.
Observed behavior

Adding agents.defaults.cliBackends.claude-cli initially validated.
After gateway reload/restart attempts, OpenClaw restored openclaw.json from backup with reload-invalid-config.
The setting disappeared again from the active config.
openclaw config get agents.defaults.cliBackends.claude-cli now returns Config path not found.
Relevant config

agents.defaults.cliBackends["claude-cli"] = { "systemPromptWhen": "never" }
Errors

Config recovery warning: OpenClaw restored openclaw.json from the last-known-good backup during reload (reload-invalid-config).
Config path not found: agents.defaults.cliBackends.claude-cli
Ask

Why is the valid cliBackends.claude-cli entry being dropped on reload?
Is there a schema or runtime mismatch causing config recovery to remove it?
What is the supported way to persist this Claude CLI setting?

soft ravenBOT
sly orchidBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

soft ravenBOT
tired cloakBOT
#

Looking at the docs and source now. I want to verify whether this is a real supported config key, or whether the validator is accepting it temporarily and then stripping it during reload.

#

Yep, I think I see it.

systemPromptWhen: "never" itself is supported for claude-cli. The part that is getting you is that the persisted schema for agents.defaults.cliBackends.<id> still requires a command.

So this:

agents: {
  defaults: {
    cliBackends: {
      "claude-cli": {
        systemPromptWhen: "never",
      },
    },
  },
}
#

looks like a reasonable override, but it is invalid as stored config because command is required.

Why it behaves weirdly:

  • Runtime merge logic does know Claude’s plugin defaults (command: "claude", systemPromptWhen: "first").
  • But config validation happens on the raw file first.
  • So reload sees "claude-cli": { systemPromptWhen: "never" } as incomplete, rejects it, and restores last-known-good.
  • Then config get ...claude-cli says path not found, because that invalid edit was rolled back.

So yes, this is basically a schema/runtime mismatch.

Supported way to persist it

Include at least command in the override:

#
agents: {
  defaults: {
    cliBackends: {
      "claude-cli": {
        command: "claude",
        systemPromptWhen: "never",
      },
    },
  },
}

On Windows, if the daemon does not see claude on PATH, use the real path from where claude instead of "claude".

Why this should also help spawn ENAMETOOLONG

#

That error is very likely coming from Claude CLI’s appended system prompt on Windows. If your config rollback keeps restoring the default systemPromptWhen: "first", OpenClaw keeps passing the long --append-system-prompt arg. Persisting "never" correctly should stop that path.

I’d test it like this

openclaw config validate
openclaw doctor

Docs:

If you want, paste:

  • openclaw --version
  • openclaw config validate
#
  • your final agents.defaults.cliBackends["claude-cli"]

and I can sanity check the exact Windows shape.

dark marten
#

PS C:\WINDOWS\system32> openclaw config validate

🦞 OpenClaw 2026.4.21 (f788c88) — Less clicking, more shipping, fewer "where did that file go" moments.

Config valid: ~.openclaw\openclaw.json

},
"cliBackends": {
"claude-cli": {
"command": "claude",
"systemPromptWhen": "never"
}
}
},

tired cloakBOT
#

Nice, that’s the key signal.

With this present:

"claude-cli": {
  "command": "claude",
  "systemPromptWhen": "never"
}

and openclaw config validate returning Config valid, the schema issue is gone.

So the earlier rollback was almost certainly the old partial object without command. systemPromptWhen: "never" is not the bad field.

What this means now

#
  • systemPromptWhen: "never" is supported on 2026.4.21
  • the persisted config shape is valid when command is included
  • if reload/restart still drops it now, that would be a separate hot-reload/recovery bug, not expected schema behavior

Next checks

  1. Restart the gateway
  2. Run:
openclaw config get agents.defaults.cliBackends.claude-cli
  1. Test Claude CLI again

If spawn ENAMETOOLONG still happens