{"record":{"id":"dd1a3bfea6d8f81e","repo":"eyaltoledano/claude-task-master","slug":"provider-name-is-required","errorCode":null,"errorMessage":"Provider name is required","messagePattern":"Provider name is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/ai-providers/openai-compatible.js","lineNumber":28,"sourceCode":"/**\n * Base class for OpenAI-compatible providers (LM Studio, Z.ai, etc.)\n * Provides a flexible foundation for any service with OpenAI-compatible endpoints.\n */\nexport class OpenAICompatibleProvider extends BaseAIProvider {\n\t/**\n\t * @param {object} config - Provider configuration\n\t * @param {string} config.name - Provider display name\n\t * @param {string} config.apiKeyEnvVar - Environment variable name for API key\n\t * @param {boolean} [config.requiresApiKey=true] - Whether API key is required\n\t * @param {string} [config.defaultBaseURL] - Default base URL for the API\n\t * @param {Function} [config.getBaseURL] - Function to determine base URL from params\n\t * @param {boolean} [config.supportsStructuredOutputs] - Whether provider supports structured outputs\n\t */\n\tconstructor(config) {\n\t\tsuper();\n\n\t\tif (!config.name) {\n\t\t\tthrow new Error('Provider name is required');\n\t\t}\n\t\tif (!config.apiKeyEnvVar) {\n\t\t\tthrow new Error('API key environment variable name is required');\n\t\t}\n\n\t\tthis.name = config.name;\n\t\tthis.apiKeyEnvVar = config.apiKeyEnvVar;\n\t\tthis.requiresApiKey = config.requiresApiKey !== false; // Default to true\n\t\tthis.defaultBaseURL = config.defaultBaseURL;\n\t\tthis.getBaseURLFromParams = config.getBaseURL;\n\t\tthis.supportsStructuredOutputs = config.supportsStructuredOutputs;\n\t}\n\n\t/**\n\t * Returns the environment variable name required for this provider's API key.\n\t * @returns {string} The environment variable name for the API key\n\t */\n\tgetRequiredApiKeyName() {","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ai-providers/openai-compatible.js#L10-L46","documentation":"OpenAICompatibleProvider's constructor validates that a provider configuration object includes a non-empty name and throws otherwise. The name is used for identification, error messages, and provider registry lookup. This is a fail-fast configuration validation at instantiation time.","triggerScenarios":"new OpenAICompatibleProvider(config) where config.name is undefined, null, or empty string — typically a mis-built provider config passed from a registry or config file.","commonSituations":"Custom provider config objects missing the 'name' field, loading provider config from JSON/YAML where the key was renamed or omitted, constructing config programmatically and forgetting name.","solutions":["Add a 'name' property to the config object passed to the provider constructor.","Check the source of the config (file/env/loader) for a missing or misnamed key.","Validate config against the documented schema before instantiating.","If loading many providers, log which config entry lacks a name."],"exampleFix":"// before\n// new OpenAICompatibleProvider({ apiKeyEnvVar: 'MY_KEY', defaultBaseURL: 'https://api.example.com/v1' })\n// after\n// new OpenAICompatibleProvider({ name: 'my-provider', apiKeyEnvVar: 'MY_KEY', defaultBaseURL: 'https://api.example.com/v1' })","handlingStrategy":"validation","validationCode":"function assertProviderConfig(config) {\n  if (!config || typeof config !== 'object') throw new TypeError('config must be an object');\n  if (typeof config.name !== 'string' || !config.name.trim()) throw new Error('provider config.name is required');\n}","typeGuard":"function isValidProviderConfig(c) {\n  return typeof c === 'object' && c !== null && typeof c.name === 'string' && c.name.length > 0;\n}","tryCatchPattern":"try {\n  const provider = new OpenAICompatibleProvider(config);\n} catch (e) {\n  if (e.message === 'Provider name is required') {\n    console.error('Config missing name:', JSON.stringify(Object.keys(config || {})));\n  }\n  throw e;\n}","preventionTips":["Validate provider configs at startup before use","Keep provider config schema documented and lint-checked","Validate JSON/YAML provider definitions on load","Always include name when constructing configs programmatically"],"tags":["configuration","validation","constructor","openai-compatible"],"backgroundTag":"missing-config-property","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}