different-ai/openwork · error

app.error_command_not_resolved

Error message

app.error_command_not_resolved

What it means

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.

Source

Thrown at apps/app/src/react-app/domains/session/sync/actions-store.ts:558

      const requestVariant = reasoningEffort ? undefined : selectedVariant;
      const promptOverrides = reasoningEffort ? ({ reasoning_effort: reasoningEffort } as const) : undefined;

      if (resolvedDraft.mode === "shell") {
        await shellInSession(c, sessionID, content);
      } else if (resolvedDraft.command || compactCommand) {
        if (compactCommand) {
          await compactCurrentSession(sessionID);
          finishPerf(perfEnabled, "session.prompt", "done", startedAt, {
            sessionID,
            mode: resolvedDraft.mode,
            command: commandName,
          });
          return;
        }

        const command = resolvedDraft.command;
        if (!command) {
          throw new Error(t("app.error_command_not_resolved"));
        }

        const modelString = `${model.providerID}/${model.modelID}`;
        const files = await buildCommandFileParts(resolvedDraft);

        unwrap(
          await c.session.command({
            sessionID,
            command: command.name,
            arguments: command.arguments,
            agent: agent ?? undefined,
            model: modelString,
            variant: requestVariant,
            ...(promptOverrides ?? {}),
            parts: files.length ? files : undefined,
          }),
        );
      } else {

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Re-select the agent/model in the composer so the draft re-resolves, then submit again.
  2. Check the agent/model configuration includes the required command definition.
  3. 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.

Example fix

// before
const command = resolvedDraft.command;
if (!command) throw new Error(t("app.error_command_not_resolved"));
// after
const command = resolvedDraft.command;
if (!command) {
  logger.error("unresolved draft", resolvedDraft);
  throw new Error(t("app.error_command_not_resolved"));
}
Defensive patterns

Strategy: validation

Validate before calling

const resolved = resolveDraft(draft);
if (!resolved?.command) {
  showToast("Agent/model could not be resolved — re-select it");
  return;
}
await submitDraft(resolved);

Type guard

function isResolvedDraft(d: unknown): d is { command: NonNullable<unknown> } {
  return typeof d === "object" && d !== null && "command" in d && Boolean((d as { command?: unknown }).command);
}

Try / catch

try {
  await submitCurrentDraft();
} catch (e) {
  if (e instanceof Error && e.message === "app.error_command_not_resolved") {
    resetComposerDraft(); // force re-resolution
    showToast("Re-select the agent/model and try again");
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/e07a158ea36d2a6c. Report an issue: GitHub.