{"record":{"id":"15fb53999a7a2b80","repo":"deepseek-ai/deepseek-harness","slug":"command-execute-failed-result-error-code-re","errorCode":null,"errorMessage":"command.execute failed: ${result.error.code}: ${result.error.message}","messagePattern":"command\\.execute failed: (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/client/ui-commands/src/client/service.ts","lineNumber":405,"sourceCode":"\n  /**\n   * The command.execute transaction, addressed to the session's agent — pure\n   * admission semantics. An unmatched line reports an error outcome (the\n   * composer's immediate admission feedback); an admitted command reports\n   * plain success regardless of its handler outcome, because the host\n   * executor durably logged the lifecycle (`command/run`/`command/done`) and\n   * the outcome renders as a persistent flow node — the composer never\n   * echoes it. A handler error result reports an error outcome so the\n   * composer keeps the submission (draft and images) for correction.\n   * Transport failures throw.\n   */\n  private async execute(\n    session: ClientSessionContext,\n    line: string,\n    images: readonly SubmitImageAttachment[] = [],\n  ): Promise<SubmitOutcome> {\n    const result = await this.ctx.remote.commands.execute(session.sessionId, line, images)\n    if (!result.ok) throw new Error(`command.execute failed: ${result.error.code}: ${result.error.message}`)\n    if (result.value === undefined) return { kind: 'error', text: `unknown or malformed command: ${line}` }\n    this.notifyExecuted(session.sessionId, submittedCommandName(line), result.value.result)\n    // An image-carrying submission consumed its images only on handler\n    // success; an error outcome keeps draft and images in the composer.\n    if (images.length > 0 && result.value.result.kind === 'error') {\n      return { kind: 'error', text: result.value.result.text }\n    }\n    return { kind: 'success' }\n  }\n\n  /** Publish the local acknowledgment without letting an observer change command admission. */\n  private notifyExecuted(sessionId: SessionId, name: string, result: CommandResult): void {\n    const args = ['command/executed', sessionId, name, result]\n    for (const listener of this.ctx.events.dispatch('emit', args) as Array<(...listenerArgs: unknown[]) => unknown>) {\n      try {\n        const returned = listener(sessionId, name, result)\n        if (returned != null && typeof (returned as PromiseLike<unknown>).then === 'function') {\n          void Promise.resolve(returned as PromiseLike<unknown>).then(undefined, (error: unknown) => {","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/client/ui-commands/src/client/service.ts#L387-L423","documentation":"execute() forwards a slash-command line (with optional image attachments) to the host via ctx.remote.commands.execute. A non-ok RPC result throws 'command.execute failed: <code>: <message>'. An unmatched command (result.value === undefined) does NOT throw — it returns an error SubmitOutcome — so this error strictly means the RPC itself rejected, not a typo in the command name.","triggerScenarios":"Submitting a slash command through leadingClaim, the result sink, or runDetached when the execute RPC rejects: the session dropped mid-submit, the host command handler failed, permission was denied, or the transport reset between Enter and execution.","commonSituations":"Connection loss right after pressing Enter; host restarting or redeploying mid-submit; host/client protocol mismatch on the commands.execute payload; oversized image attachment rejected by a gateway body limit.","solutions":["Inspect the embedded error.code to classify the failure (transport versus host refusal)","Reconnect and resubmit — the composer preserved the failed line","Verify host and client versions agree on the commands.execute contract","Cap or compress image attachments before submit if the code suggests a payload limit"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!connectionHealthy()) await reconnect()","typeGuard":null,"tryCatchPattern":"try {\n  const outcome = await submitSlash(line, images)\n} catch (error) {\n  surfaceSubmitError(error) // composer keeps the line; offer retry\n}","preventionTips":["Serialize submits through one attempt latch so a dropped connection cannot double-fire","Version-check the host on connect before enabling slash submission","Report the embedded error code verbatim in diagnostics"],"tags":["rpc","slash-commands","submit","reconnect"],"backgroundTag":"rpc-request-failed","analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}