{"record":{"id":"652f48f96cc3f088","repo":"iOfficeAI/AionUi","slug":"aionrsmodelrequiredmessage","errorCode":null,"errorMessage":"aionrsModelRequiredMessage","messagePattern":"aionrsModelRequiredMessage","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop/src/renderer/pages/cron/ScheduledTasksPage/resolveCronAgentConfig.ts","lineNumber":60,"sourceCode":"    aionrsModelRequiredMessage,\n  } = input;\n\n  const colonIdx = agentValue.indexOf(':');\n  const prefixedId = colonIdx >= 0 ? agentValue.substring(colonIdx + 1) : agentValue;\n  const assistantSelection = presetAssistants.find((item) => item.id === prefixedId || item.id === agentValue);\n  if (!assistantSelection) {\n    throw new Error('assistant_id is required');\n  }\n\n  let agent_config: ICronAgentConfigWrite | undefined;\n\n  const assistant = assistantSelection;\n  const assistantName = resolveAssistantName(assistant, localeKey, assistant.name);\n  const mode = getMode(assistant);\n\n  if (isAionrsAssistant(assistant)) {\n    if (!selectedAionrsProvider?.id || !model_id) {\n      throw new Error(aionrsModelRequiredMessage);\n    }\n    agent_config = {\n      name: assistantName,\n      assistant_id: assistant.id,\n      mode,\n      model_id,\n      model: {\n        provider_id: selectedAionrsProvider.id,\n        model: model_id,\n        use_model: model_id,\n      },\n      workspace,\n    };\n  } else {\n    agent_config = {\n      name: assistantName,\n      assistant_id: assistant.id,\n      mode,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/iOfficeAI/AionUi/blob/711aa0550ee183ea495dc33e2c05c7943b70a60a/packages/desktop/src/renderer/pages/cron/ScheduledTasksPage/resolveCronAgentConfig.ts#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the AionRS provider is configured and selected before the model field becomes editable","Confirm the models list loaded and a model_id is set in form state; disable submit until both are present","If model fetching failed, retry loading providers/models and surface the load error to the user","Guard the submit handler with client-side validation so the user gets a message instead of an exception"],"exampleFix":"// before\nif (isAionrsAssistant(assistant)) {\n  if (!selectedAionrsProvider?.id || !model_id) {\n    throw new Error(aionrsModelRequiredMessage);\n  }\n\n// after (block submit in UI + keep guard)\nconst aionrsReady = !isAionrsAssistant(assistant) || (!!selectedAionrsProvider?.id && !!model_id);\n<Button disabled={!aionrsReady} onClick={handleSubmit}>…</Button>","handlingStrategy":"validation","validationCode":"if (isAionrsAssistant(assistant) && (!providerId || !modelId)) { /* block submit, show hint */ }","typeGuard":"const isAionrsConfigComplete = (p?: {id?: string}, m?: string): boolean => !!p?.id && !!m;","tryCatchPattern":"catch (e) { toast.warning(e.message === aionrsModelRequiredMessage ? t('cron.modelRequired') : e.message); }","preventionTips":["Load providers/models before enabling the form","Make the model dropdown required for AionRS assistants"],"tags":["cron","scheduled-tasks","aionrs","model-config","validation"],"backgroundTag":"required-config-field-missing","analyzedSha":"711aa0550ee183ea495dc33e2c05c7943b70a60a","analyzedAt":"2026-08-28T07:56:06.558Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}