iOfficeAI/AionUi · error

aionrsModelRequiredMessage

Error message

aionrsModelRequiredMessage

What it means

For AionRS-mode assistants in scheduled tasks, both a provider (`selectedAionrsProvider?.id`) and a `model_id` are mandatory. This error throws when either is missing while building the cron agent config, preventing creation of a scheduled task that would have no runnable model.

Source

Thrown at packages/desktop/src/renderer/pages/cron/ScheduledTasksPage/resolveCronAgentConfig.ts:60

    aionrsModelRequiredMessage,
  } = input;

  const colonIdx = agentValue.indexOf(':');
  const prefixedId = colonIdx >= 0 ? agentValue.substring(colonIdx + 1) : agentValue;
  const assistantSelection = presetAssistants.find((item) => item.id === prefixedId || item.id === agentValue);
  if (!assistantSelection) {
    throw new Error('assistant_id is required');
  }

  let agent_config: ICronAgentConfigWrite | undefined;

  const assistant = assistantSelection;
  const assistantName = resolveAssistantName(assistant, localeKey, assistant.name);
  const mode = getMode(assistant);

  if (isAionrsAssistant(assistant)) {
    if (!selectedAionrsProvider?.id || !model_id) {
      throw new Error(aionrsModelRequiredMessage);
    }
    agent_config = {
      name: assistantName,
      assistant_id: assistant.id,
      mode,
      model_id,
      model: {
        provider_id: selectedAionrsProvider.id,
        model: model_id,
        use_model: model_id,
      },
      workspace,
    };
  } else {
    agent_config = {
      name: assistantName,
      assistant_id: assistant.id,
      mode,

View on GitHub (pinned to 711aa0550e)

Solutions

  1. Ensure the AionRS provider is configured and selected before the model field becomes editable
  2. Confirm the models list loaded and a model_id is set in form state; disable submit until both are present
  3. If model fetching failed, retry loading providers/models and surface the load error to the user
  4. Guard the submit handler with client-side validation so the user gets a message instead of an exception

Example fix

// before
if (isAionrsAssistant(assistant)) {
  if (!selectedAionrsProvider?.id || !model_id) {
    throw new Error(aionrsModelRequiredMessage);
  }

// after (block submit in UI + keep guard)
const aionrsReady = !isAionrsAssistant(assistant) || (!!selectedAionrsProvider?.id && !!model_id);
<Button disabled={!aionrsReady} onClick={handleSubmit}>…</Button>
Defensive patterns

Strategy: validation

Validate before calling

if (isAionrsAssistant(assistant) && (!providerId || !modelId)) { /* block submit, show hint */ }

Type guard

const isAionrsConfigComplete = (p?: {id?: string}, m?: string): boolean => !!p?.id && !!m;

Try / catch

catch (e) { toast.warning(e.message === aionrsModelRequiredMessage ? t('cron.modelRequired') : e.message); }

Prevention

When it happens

Trigger: Submitting a scheduled task with an AionRS assistant selected while the AionRS provider is not chosen/configured, or the model dropdown was left empty (model_id undefined) because models are still loading or failed to load.

Common situations: AionRS provider not configured or its model list fetch failed so no model_id was ever set; user cleared the model selection; race where the form submits before provider/model options populate; provider credentials missing so provider id resolves empty.

Related errors


AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28). Data as JSON: /api/errors/652f48f96cc3f088. Report an issue: GitHub.