{"record":{"id":"cdd237f2357faf17","repo":"Budibase/budibase","slug":"ai-prompt-messages-must-be-strings","errorCode":null,"errorMessage":"AI prompt messages must be strings","messagePattern":"AI prompt messages must be strings","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/instructions.ts","lineNumber":46,"sourceCode":"  goal,\n  toolReferences,\n}: GenerateAgentInstructionsRequest) {\n  const request = ai.generateOperationInstructionsPrompt({\n    prompt,\n    agentName,\n    goal,\n    toolReferences,\n  })\n\n  const systemMessage = request.messages.find(\n    message => message.role === \"system\"\n  )?.content\n  const userMessage = request.messages.find(\n    message => message.role === \"user\"\n  )?.content\n\n  if (typeof systemMessage !== \"string\" || typeof userMessage !== \"string\") {\n    throw new Error(\"AI prompt messages must be strings\")\n  }\n\n  const { chat, providerOptions } = await sdk.ai.llm.getDefaultLLMOrThrow()\n  const result = await generateText({\n    model: chat,\n    instructions: systemMessage,\n    prompt: userMessage,\n    providerOptions: providerOptions?.(false),\n  })\n\n  const instructions = sanitizeInstructions(result.text || \"\")\n\n  if (!instructions) {\n    throw new Error(\"Failed to generate instructions\")\n  }\n\n  return instructions\n}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/instructions.ts#L28-L64","documentation":"Error \"AI prompt messages must be strings\" thrown in Budibase/budibase.","triggerScenarios":"Thrown at packages/server/src/sdk/workspace/ai/instructions.ts:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}