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

  1. Upgrade the slock CLI — this indicates an internal bug likely fixed upstream
  2. Report the bug with the command and arguments used; include the r.parent value in the message
  3. 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

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1aef8ed447439e5f. Report an issue: GitHub.