jackwener/OpenCLI · error · CommandExecutionError

HTTP ${r.status} from ${r.where}

Error message

HTTP ${r.status} from ${r.where}

What it means

dispatchEvaluateResult maps an 'http' envelope to CommandExecutionError with the message `HTTP <status> from <where>`. The in-page fetch to the slock API returned a non-2xx status and the snippet surfaced it with the status code and the endpoint/where it happened.

Source

Thrown at clis/slock/errors.js:18

import { ArgumentError, AuthRequiredError, CommandExecutionError, ConfigError } from '@jackwener/opencli/errors';
import { SLOCK_DOMAIN } from './shared.js';

// EvaluateResult is the envelope every in-page snippet returns. Kinds:
//   { kind: 'ok', rows, meta? }
//   { kind: 'auth', detail }
//   { 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. Read the HTTP status in the message: 403/404 usually means wrong or forbidden channel — verify the channelId/#name
  2. Retry after a delay if the status is 429 or 5xx (transient)
  3. Check your membership in the target channel in the slock web app before rerunning
Defensive patterns

Strategy: retry

Validate before calling

// pre-verify the channel exists and is accessible:
const members = await runChannelMembers(channel); // 404/403 here means fix the channel first

Type guard

const isHttpError = (e) => e instanceof CommandExecutionError && /^HTTP \d{3}/.test(e.message);

Try / catch

try { return await slockCommand(); } catch (e) { if (isHttpError(e) && /(429|5\d\d)/.test(e.message)) { await sleep(2000); return retry(slockCommand, 3); } throw e; }

Prevention

When it happens

Trigger: Any slock command whose snippet fetch returns 4xx/5xx: 403 (no permission to the channel), 404 (channel id doesn't exist), 429 (rate limit), 500 (server error).

Common situations: Referencing a #name that resolves to a deleted channel; lacking membership/permission for a private channel; hitting API rate limits with high --limit/pagination loops.

Related errors


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