deepseek-ai/deepseek-harness · error
command.execute failed: ${result.error.code}: ${result.error
Error message
command.execute failed: ${result.error.code}: ${result.error.message} What it means
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.
Source
Thrown at packages/client/ui-commands/src/client/service.ts:405
/**
* The command.execute transaction, addressed to the session's agent — pure
* admission semantics. An unmatched line reports an error outcome (the
* composer's immediate admission feedback); an admitted command reports
* plain success regardless of its handler outcome, because the host
* executor durably logged the lifecycle (`command/run`/`command/done`) and
* the outcome renders as a persistent flow node — the composer never
* echoes it. A handler error result reports an error outcome so the
* composer keeps the submission (draft and images) for correction.
* Transport failures throw.
*/
private async execute(
session: ClientSessionContext,
line: string,
images: readonly SubmitImageAttachment[] = [],
): Promise<SubmitOutcome> {
const result = await this.ctx.remote.commands.execute(session.sessionId, line, images)
if (!result.ok) throw new Error(`command.execute failed: ${result.error.code}: ${result.error.message}`)
if (result.value === undefined) return { kind: 'error', text: `unknown or malformed command: ${line}` }
this.notifyExecuted(session.sessionId, submittedCommandName(line), result.value.result)
// An image-carrying submission consumed its images only on handler
// success; an error outcome keeps draft and images in the composer.
if (images.length > 0 && result.value.result.kind === 'error') {
return { kind: 'error', text: result.value.result.text }
}
return { kind: 'success' }
}
/** Publish the local acknowledgment without letting an observer change command admission. */
private notifyExecuted(sessionId: SessionId, name: string, result: CommandResult): void {
const args = ['command/executed', sessionId, name, result]
for (const listener of this.ctx.events.dispatch('emit', args) as Array<(...listenerArgs: unknown[]) => unknown>) {
try {
const returned = listener(sessionId, name, result)
if (returned != null && typeof (returned as PromiseLike<unknown>).then === 'function') {
void Promise.resolve(returned as PromiseLike<unknown>).then(undefined, (error: unknown) => {View on GitHub (pinned to b150a551b8)
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
Defensive patterns
Strategy: try-catch
Validate before calling
if (!connectionHealthy()) await reconnect()
Try / catch
try {
const outcome = await submitSlash(line, images)
} catch (error) {
surfaceSubmitError(error) // composer keeps the line; offer retry
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- command directory warmup failed: ${entry.lastError instanceo
- command.list failed: ${result.error.code}: ${result.error.me
- conversation.send failed: ${result.error.code}: ${result.err
- permission switch failed: ${result.error.code}: ${result.err
- context-not-found
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/15fb53999a7a2b80.
Report an issue: GitHub.