chatboxai/chatbox · error · Error

Command safety assessment requires system message support

Error message

Command safety assessment requires system message support

What it means

Thrown by generateCommandExplanation() when the selected model reports it does not support system messages (model.isSupportSystemMessage() is false). The command-safety assessment pipeline depends on a system message to set instructions/tool semantics, so it cannot run on models lacking that capability.

Source

Thrown at src/renderer/packages/model-calls/command-explanation.ts:117

  return assessment.decision === 'approve' && assessment.riskFlags.length === 0
}

function formatCommandAssessment(assessment: CommandAssessment): string {
  const indicator = isCommandAssessmentSafe(assessment) ? '✅' : '⚠️'
  return `${assessment.summary}\n${indicator} ${assessment.reason}`
}

export async function generateCommandExplanation(
  settings: SessionSettings,
  command: string,
  userContext: string,
  onStreamUpdate?: (text: string) => void,
  signal?: AbortSignal
): Promise<CommandExplanationResult> {
  throwIfAborted(signal)
  const model = await createModel(settings)
  if (!model.isSupportSystemMessage()) {
    throw new Error('Command safety assessment requires system message support')
  }
  const language = languageNameMap[settingsStore.getState().getSettings().language] || 'English'
  const messages = buildExplanationMessages(command, userContext, language)
  const coreMessages = await convertToModelMessages(messages, { modelSupportVision: model.isSupportVision() })

  const result = await model.chat(coreMessages, {
    signal,
    tools: commandAssessmentTools,
    maxSteps: 1,
  })
  throwIfAborted(signal)
  const assessmentCalls =
    result.contentParts?.filter(
      (part): part is MessageContentToolCallPart =>
        part.type === 'tool-call' && part.toolName === COMMAND_ASSESSMENT_TOOL_NAME
    ) ?? []
  if (assessmentCalls.length !== 1) {
    throw new Error('Command safety assessment tool was not called exactly once')

View on GitHub (pinned to 81571269ad)

Solutions

  1. Switch to a model that supports system messages (most OpenAI/Anthropic/Gemini models do).
  2. If using a custom/OpenAI-compatible provider, ensure its capability flags report system-message support correctly.
  3. Disable the command-explanation feature for models known to lack system support, rather than retrying.
Defensive patterns

Strategy: type-guard

Validate before calling

const model = await createModel(settings)
if (!model.isSupportSystemMessage()) {
  // disable command-explanation feature for this model; do not call generateCommandExplanation
}

Type guard

function modelSupportsSystemMessages(model: { isSupportSystemMessage(): boolean }): boolean {
  return model.isSupportSystemMessage()
}

Try / catch

try {
  await generateCommandExplanation(settings, command, ctx)
} catch (e) {
  if (e instanceof Error && e.message === 'Command safety assessment requires system message support') {
    // fall back to running the command without the safety assessment, or pick another model
  }
}

Prevention

When it happens

Trigger: Selecting a model provider/variant that does not implement system-message support, then triggering command explanation/safety assessment. The guard is `if (!model.isSupportSystemMessage()) throw ...`.

Common situations: User switches to a local or older model that omits system role; a custom OpenAI-compatible endpoint whose model capabilities flag is misconfigured; using a model whose adapter did not advertise system-message support.

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/a5bbdfe16b7c7faa. Report an issue: GitHub.