{"record":{"id":"354cc14253403e6f","repo":"jackwener/OpenCLI","slug":"run-opencli-slock-server-use-slug-to-set-the-a","errorCode":null,"errorMessage":"Run `opencli slock server-use <slug>` to set the active server.","messagePattern":"Run `opencli slock server-use <slug>` to set the active server\\.","errorType":"exception","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"clis/slock/errors.js","lineNumber":20,"sourceCode":"import { SLOCK_DOMAIN } from './shared.js';\n\n// EvaluateResult is the envelope every in-page snippet returns. Kinds:\n//   { kind: 'ok', rows, meta? }\n//   { kind: 'auth', detail }\n//   { kind: 'http', status, where }\n//   { kind: 'no-server', detail }\n//   { kind: 'unresolvable', detail }\n//   { kind: 'no-thread', parent }       // handled by caller, never reaches dispatcher\nexport function dispatchEvaluateResult(r) {\n  switch (r && r.kind) {\n    case 'ok':\n      return r.rows;\n    case 'auth':\n      throw new AuthRequiredError(SLOCK_DOMAIN, r.detail);\n    case 'http':\n      throw new CommandExecutionError(`HTTP ${r.status} from ${r.where}`);\n    case 'no-server':\n      throw new ConfigError(r.detail, 'Run `opencli slock server-use <slug>` to set the active server.');\n    case 'unresolvable':\n      throw new ArgumentError(r.detail);\n    case 'no-thread':\n      // caller decides what to do (returns a 0-row hint); should never reach here\n      throw new CommandExecutionError(`no-thread should be handled by caller, not dispatcher: ${r.parent}`);\n    default:\n      // unknown / null envelope = contract drift; fail loud (reddit precedent)\n      throw new CommandExecutionError(`unexpected evaluate envelope: ${JSON.stringify(r)}`);\n  }\n}\n","sourceCodeStart":2,"sourceCodeEnd":31,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/errors.js#L2-L31","documentation":"When the in-page snippet reports a 'no-server' envelope, dispatchEvaluateResult throws ConfigError with the message 'Run `opencli slock server-use <slug>` to set the active server.' The command is server-scoped but no active server is configured in the CLI.","triggerScenarios":"Running any server-scoped slock command (dm-list, inbox, channel-members, etc.) before ever selecting a server, or after the active server config entry was removed.","commonSituations":"Fresh install of the CLI with config not initialized; switching machines or profiles and forgetting to re-select the active server; config file cleaned/reset.","solutions":["Run `opencli slock server-use <slug>` to set the active server","Run `opencli slock server-list` first if you don't know the slug","Pass `--server <slug-or-id>` on the command to override the active server for one invocation"],"exampleFix":"// before\nopencli slock dm-list\n// after\nopencli slock server-use my-workspace\nopencli slock dm-list","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(fs.readFileSync(activeServerConfigPath, 'utf8'));\nif (!cfg.activeServer) { console.error('No active server. Run: opencli slock server-use <slug>'); process.exit(2); }","typeGuard":"const hasActiveServer = (cfg) => typeof cfg?.activeServer === 'string' && cfg.activeServer.length > 0;","tryCatchPattern":"try { await slockCommand(); } catch (e) { if (e instanceof ConfigError) { console.error(e.message); cp.execSync('opencli slock server-use <slug>'); return retryOnce(slockCommand); } throw e; }","preventionTips":["Run `server-use` as part of environment/CI setup","Pass --server explicitly in scripts to avoid relying on active-server state","Keep the CLI config file out of cleanup routines"],"tags":["config","cli","missing-config"],"backgroundTag":"missing-env-var","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}