{"record":{"id":"3d2924cebc88dd0e","repo":"eyaltoledano/claude-task-master","slug":"getclient-must-be-implemented-by-provider","errorCode":null,"errorMessage":"getClient must be implemented by provider","messagePattern":"getClient must be implemented by provider","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/ai-providers/base-provider.js","lineNumber":267,"sourceCode":"\t/**\n\t * Common error handler\n\t */\n\thandleError(operation, error) {\n\t\tconst errorMessage = error.message || 'Unknown error occurred';\n\t\tlog('error', `${this.name} ${operation} failed: ${errorMessage}`, {\n\t\t\terror\n\t\t});\n\t\tthrow new Error(\n\t\t\t`${this.name} API error during ${operation}: ${errorMessage}`\n\t\t);\n\t}\n\n\t/**\n\t * Creates and returns a client instance for the provider\n\t * @abstract\n\t */\n\tgetClient(params) {\n\t\tthrow new Error('getClient must be implemented by provider');\n\t}\n\n\t/**\n\t * Returns if the API key is required\n\t * @abstract\n\t * @returns {boolean} if the API key is required, defaults to true\n\t */\n\tisRequiredApiKey() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns the required API key environment variable name\n\t * @abstract\n\t * @returns {string|null} The environment variable name, or null if no API key is required\n\t */\n\tgetRequiredApiKeyName() {\n\t\tthrow new Error('getRequiredApiKeyName must be implemented by provider');","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ai-providers/base-provider.js#L249-L285","documentation":"This is an abstract-method guard: BaseAIProvider.getClient is abstract and must be overridden by each concrete provider subclass to return an SDK client instance. Throwing this error means a subclass (or a hand-rolled provider) failed to implement getClient, or getClient was invoked directly on the base class.","triggerScenarios":"Instantiating a custom provider that extends BaseAIProvider without overriding getClient, then calling generateText/streamText/etc., which internally calls this.client and therefore getClient. Also triggered by calling baseProvider.getClient(params) on the abstract base directly.","commonSituations":"Writing a new provider integration and forgetting the override; typos in the method name (e.g. getClient incorrectly cased); refactoring a provider that accidentally removed the method; mocking/partial-spreading a provider object that dropped the method.","solutions":["Implement getClient(params) in your provider subclass returning the provider's SDK client","Check the method name spelling and that it's an own method (not lost via object spread)","Extend an existing concrete provider (e.g. GoogleVertexProvider) instead of BaseAIProvider if you don't need custom client logic"],"exampleFix":"// before\nclass MyProvider extends BaseAIProvider {\n  // no getClient\n}\n// after\nclass MyProvider extends BaseAIProvider {\n  getClient(params) {\n    return createMySdkClient({ apiKey: this.apiKey });\n  }\n}","handlingStrategy":"type-guard","validationCode":"function checkProviderUsable(provider) {\n  if (typeof provider.getClient !== 'function' || BaseAIProvider.prototype.getClient === provider.getClient) {\n    throw new Error('Provider does not implement getClient');\n  }\n}","typeGuard":"function implementsGetClient(provider) {\n  return typeof provider?.getClient === 'function' &&\n    provider.getClient !== BaseAIProvider.prototype.getClient;\n}","tryCatchPattern":"try {\n  await provider.generateText({ messages, modelId });\n} catch (e) {\n  if (e.message === 'getClient must be implemented by provider') {\n    throw new Error('Provider subclass is missing a getClient() override — fix the provider implementation');\n  }\n  throw e;\n}","preventionTips":["Always override getClient when subclassing BaseAIProvider","Add a smoke test that instantiates each provider and performs a trivial call","Avoid spreading/partial provider objects that can drop methods"],"tags":["abstract-method","subclassing","implementation-missing"],"backgroundTag":"unimplemented-abstract-method","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}