{"record":{"id":"e07a158ea36d2a6c","repo":"different-ai/openwork","slug":"app-error-command-not-resolved","errorCode":null,"errorMessage":"app.error_command_not_resolved","messagePattern":"app\\.error_command_not_resolved","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/session/sync/actions-store.ts","lineNumber":558,"sourceCode":"      const requestVariant = reasoningEffort ? undefined : selectedVariant;\n      const promptOverrides = reasoningEffort ? ({ reasoning_effort: reasoningEffort } as const) : undefined;\n\n      if (resolvedDraft.mode === \"shell\") {\n        await shellInSession(c, sessionID, content);\n      } else if (resolvedDraft.command || compactCommand) {\n        if (compactCommand) {\n          await compactCurrentSession(sessionID);\n          finishPerf(perfEnabled, \"session.prompt\", \"done\", startedAt, {\n            sessionID,\n            mode: resolvedDraft.mode,\n            command: commandName,\n          });\n          return;\n        }\n\n        const command = resolvedDraft.command;\n        if (!command) {\n          throw new Error(t(\"app.error_command_not_resolved\"));\n        }\n\n        const modelString = `${model.providerID}/${model.modelID}`;\n        const files = await buildCommandFileParts(resolvedDraft);\n\n        unwrap(\n          await c.session.command({\n            sessionID,\n            command: command.name,\n            arguments: command.arguments,\n            agent: agent ?? undefined,\n            model: modelString,\n            variant: requestVariant,\n            ...(promptOverrides ?? {}),\n            parts: files.length ? files : undefined,\n          }),\n        );\n      } else {","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/session/sync/actions-store.ts#L540-L576","documentation":"When submitting a command/prompt, the resolved draft should contain a command; if resolvedDraft.command is falsy the store throws the localized 'app.error_command_not_resolved' message. This guards the submit path against a draft whose command resolution (model/agent command mapping) silently failed.","triggerScenarios":"User submits a prompt/command while the draft's command could not be resolved — e.g. the selected agent/model has no command mapping, the draft was built before resolution completed, or resolution returned undefined due to unknown provider/model IDs.","commonSituations":"Selecting a model/agent whose config lacks the expected command; stale draft from a switched session; custom agent config missing command fields after an app update.","solutions":["Re-select the agent/model in the composer so the draft re-resolves, then submit again.","Check the agent/model configuration includes the required command definition.","Inspect resolvedDraft just before submit to see which field failed to resolve; fix the draft-building/resolution code if a valid selection yields no command."],"exampleFix":"// before\nconst command = resolvedDraft.command;\nif (!command) throw new Error(t(\"app.error_command_not_resolved\"));\n// after\nconst command = resolvedDraft.command;\nif (!command) {\n  logger.error(\"unresolved draft\", resolvedDraft);\n  throw new Error(t(\"app.error_command_not_resolved\"));\n}","handlingStrategy":"validation","validationCode":"const resolved = resolveDraft(draft);\nif (!resolved?.command) {\n  showToast(\"Agent/model could not be resolved — re-select it\");\n  return;\n}\nawait submitDraft(resolved);","typeGuard":"function isResolvedDraft(d: unknown): d is { command: NonNullable<unknown> } {\n  return typeof d === \"object\" && d !== null && \"command\" in d && Boolean((d as { command?: unknown }).command);\n}","tryCatchPattern":"try {\n  await submitCurrentDraft();\n} catch (e) {\n  if (e instanceof Error && e.message === \"app.error_command_not_resolved\") {\n    resetComposerDraft(); // force re-resolution\n    showToast(\"Re-select the agent/model and try again\");\n    return;\n  }\n  throw e;\n}","preventionTips":["Re-resolve the draft whenever the selected agent/model/session changes instead of caching it.","Validate agent/model configs include the required command field at load time.","Disable the submit button until the draft resolution succeeds."],"tags":["command","draft","resolution"],"backgroundTag":"command-not-resolved","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}