jackwener/OpenCLI · error · CommandExecutionError
no-thread should be handled by caller, not dispatcher: ${r.p
Error message
no-thread should be handled by caller, not dispatcher: ${r.parent} What it means
The 'no-thread' envelope is a contract-level sentinel that callers are supposed to intercept and turn into a 0-row hint. If it reaches dispatchEvaluateResult, it throws CommandExecutionError with this defensive message plus the parent reference. This is an internal contract-violation guard, indicating a bug in the calling command's flow, not a user error.
Source
Thrown at clis/slock/errors.js:25
// { kind: 'http', status, where }
// { kind: 'no-server', detail }
// { kind: 'unresolvable', detail }
// { kind: 'no-thread', parent } // handled by caller, never reaches dispatcher
export function dispatchEvaluateResult(r) {
switch (r && r.kind) {
case 'ok':
return r.rows;
case 'auth':
throw new AuthRequiredError(SLOCK_DOMAIN, r.detail);
case 'http':
throw new CommandExecutionError(`HTTP ${r.status} from ${r.where}`);
case 'no-server':
throw new ConfigError(r.detail, 'Run `opencli slock server-use <slug>` to set the active server.');
case 'unresolvable':
throw new ArgumentError(r.detail);
case 'no-thread':
// caller decides what to do (returns a 0-row hint); should never reach here
throw new CommandExecutionError(`no-thread should be handled by caller, not dispatcher: ${r.parent}`);
default:
// unknown / null envelope = contract drift; fail loud (reddit precedent)
throw new CommandExecutionError(`unexpected evaluate envelope: ${JSON.stringify(r)}`);
}
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Upgrade the slock CLI — this indicates an internal bug likely fixed upstream
- Report the bug with the command and arguments used; include the r.parent value in the message
- As a workaround, use a command targeting an existing thread/channel
Defensive patterns
Strategy: try-catch
Validate before calling
// caller-side: intercept the sentinel before dispatching if (result && result.kind === 'no-thread') return []; // 0-row hint, never call dispatchEvaluateResult
Type guard
const isNoThreadEnvelope = (r) => r != null && typeof r === 'object' && r.kind === 'no-thread';
Try / catch
try { return dispatchEvaluateResult(result); } catch (e) { if (/no-thread should be handled by caller/.test(e.message)) { console.error('CLI bug: update the slock CLI'); return []; } throw e; } Prevention
- Always check r.kind === 'no-thread' before calling the dispatcher
- Keep caller templates (makeThreadStateCommand) and dispatcher in the same version
- Report this as a bug — it indicates internal contract violation
When it happens
Trigger: A command built with makeThreadStateCommand (or a caller of dispatchEvaluateResult) failed to check r.kind === 'no-thread' before dispatching; a refactor dropped the caller-side no-thread branch.
Common situations: Thread-scoped commands run against a channel where no thread/parent exists and the caller didn't handle the sentinel; running an outdated CLI version with mismatched dispatcher/caller code.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- unexpected evaluate envelope: ${JSON.stringify(r)}
- expected files array, got ${typeof files} (contract drift?)
- expected array of rows from server, got ${typeof rows} (cont
- expected array of DM channels, got ${typeof rows} (contract
- expected inbox items array, got ${typeof items} (contract dr
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1aef8ed447439e5f.
Report an issue: GitHub.