{"record":{"id":"d79d3ce5a1c33bb7","repo":"alibaba/page-agent","slug":"pageagent-llm-configuration-required-please-pro","errorCode":null,"errorMessage":"[PageAgent] LLM configuration required. Please provide: baseURL, model. See: https://alibaba.github.io/page-agent/docs/features/models","messagePattern":"\\[PageAgent\\] LLM configuration required\\. Please provide: baseURL, model\\. See: https://alibaba\\.github\\.io/page-agent/docs/features/models","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/llms/src/index.ts","lineNumber":86,"sourceCode":"\t\t\treturn await fn()\n\t\t} catch (error: unknown) {\n\t\t\tif ((error as any)?.name === 'AbortError') throw error\n\t\t\tif (error instanceof InvokeError && !error.retryable) throw error\n\t\t\tattempt++\n\t\t\tif (attempt > settings.maxRetries) throw error\n\n\t\t\tconsole.debug('[LLM] retryable failure, will retry:', error)\n\t\t\tsettings.onRetry(attempt, error as Error)\n\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, 100))\n\t\t}\n\t}\n}\n\nexport function parseLLMConfig(config: LLMConfig): ResolvedLLMConfig {\n\t// Runtime validation as defensive programming (types already guarantee these)\n\tif (!config.baseURL || !config.model) {\n\t\tthrow new Error(\n\t\t\t'[PageAgent] LLM configuration required. Please provide: baseURL, model. ' +\n\t\t\t\t'See: https://alibaba.github.io/page-agent/docs/features/models'\n\t\t)\n\t}\n\n\tif (config.temperature !== undefined) {\n\t\tconsole.warn(\n\t\t\t'[PageAgent] LLMConfig.temperature is deprecated and will be removed in a future version. ' +\n\t\t\t\t'Use transformRequestBody to set it only for models you have verified accept it.'\n\t\t)\n\t}\n\n\treturn {\n\t\tbaseURL: config.baseURL,\n\t\tmodel: config.model,\n\t\tapiKey: config.apiKey || '',\n\t\ttemperature: config.temperature,\n\t\tmaxRetries: config.maxRetries ?? 2,","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/alibaba/page-agent/blob/d02db1ee7c41f5315beda88bab2fe935c580f662/packages/llms/src/index.ts#L68-L104","documentation":"parseLLMConfig does runtime validation on the LLMConfig object and throws a plain Error when baseURL or model is falsy. Types claim these are required, but values from user config, env vars, or partial objects can be empty strings/undefined at runtime — hence the defensive check.","triggerScenarios":"Constructing PageAgent / parseLLMConfig with a config where baseURL or model is undefined, null, or '' — e.g. env vars not set (process.env.OPENAI_BASE_URL), or a config object built conditionally that skips the LLM block.","commonSituations":"Missing .env entries in deployment; typo'd env var names; config assembled from optional JSON where llm section is absent; passing an OpenAIClient config shape that doesn't have baseURL (it uses a different key).","solutions":["Set both baseURL and model explicitly in the LLMConfig passed to PageAgent","If sourcing from env, provide defaults or fail fast with a clear message when vars are missing","Verify the key names: it's baseURL (not baseUrl/API_URL) and model (not modelName)","See the linked docs page for supported provider configurations"],"exampleFix":"// before\nnew PageAgent({ llm: { baseURL: process.env.LLM_BASE_URL, model: process.env.LLM_MODEL } })\n\n// after\nif (!process.env.LLM_BASE_URL || !process.env.LLM_MODEL) {\n  throw new Error('Missing LLM_BASE_URL / LLM_MODEL environment variables')\n}\nnew PageAgent({\n  llm: {\n    baseURL: process.env.LLM_BASE_URL,\n    model: process.env.LLM_MODEL,\n  },\n})","handlingStrategy":"validation","validationCode":"function assertLLMConfig(c: LLMConfig): void {\n  if (!c?.baseURL || !c?.model) {\n    throw new Error(`Missing LLM config: baseURL=${c?.baseURL}, model=${c?.model}`)\n  }\n}\nassertLLMConfig(config)","typeGuard":"function hasLLMConfig(c: Partial<LLMConfig> | undefined): c is LLMConfig {\n  return typeof c?.baseURL === 'string' && c.baseURL.length > 0 &&\n         typeof c?.model === 'string' && c.model.length > 0\n}","tryCatchPattern":"null","preventionTips":["Fail fast at app startup with a clear message when env vars are missing","Use exact key names: baseURL and model","Add a startup config validation step in deployment pipelines"],"tags":["config","llm","missing-config","runtime-validation"],"backgroundTag":"missing-required-config","analyzedSha":"d02db1ee7c41f5315beda88bab2fe935c580f662","analyzedAt":"2026-08-28T19:39:48.634Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}