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
- Read the HTTP status in the message: 403/404 usually means wrong or forbidden channel — verify the channelId/#name
- Retry after a delay if the status is 429 or 5xx (transient)
- 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
- Verify channel ids/#names exist before calling
- Reduce --limit / add delays when paginating to avoid 429s
- Check channel membership/permissions in the web app for 403s
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
- HTTP ${probe.httpStatus} from Gitee /api/v5/user
- HTTP ${probe.httpStatus} from auth_data
- HTTP ${code}
- 12306 queryByTrainNo returned HTTP ${resp.status}
- 12306 queryByTrainNo returned non-JSON body
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bc4c56a71e708793.
Report an issue: GitHub.