{"record":{"id":"c31807b14acc0be3","repo":"eyaltoledano/claude-task-master","slug":"this-getname-provider-error-errormessage","errorCode":null,"errorMessage":"${this.getName()} provider error: ${errorMessage}","messagePattern":"(.+?) provider error: (.+?)","errorType":"error_code","errorClass":"TaskMasterError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/ai/providers/base-provider.ts","lineNumber":269,"sourceCode":"\t\t\tprovider: this.getName(),\n\t\t\ttimestamp: request.metadata.timestamp,\n\t\t\tduration,\n\t\t\tfinishReason: result.finishReason\n\t\t};\n\t}\n\n\t/**\n\t * Handle errors with proper wrapping\n\t */\n\tprotected handleError(error: unknown): never {\n\t\tif (error instanceof TaskMasterError) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\tconst errorCode = this.getErrorCode(error);\n\n\t\tthrow new TaskMasterError(\n\t\t\t`${this.getName()} provider error: ${errorMessage}`,\n\t\t\terrorCode,\n\t\t\t{\n\t\t\t\toperation: 'generateCompletion',\n\t\t\t\tresource: this.getName(),\n\t\t\t\tdetails:\n\t\t\t\t\terror instanceof Error\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tname: error.name,\n\t\t\t\t\t\t\t\tstack: error.stack,\n\t\t\t\t\t\t\t\tmodel: this.model\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: { error: String(error), model: this.model }\n\t\t\t},\n\t\t\terror instanceof Error ? error : undefined\n\t\t);\n\t}\n","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/ai/providers/base-provider.ts#L251-L287","documentation":"This is a wrapped provider error thrown by the base AI provider class. When a concrete provider's generateCompletion fails, the base class captures the underlying message and error code and re-throws it as a TaskMasterError prefixed with the provider name, tagged with operation 'generateCompletion' and resource '<provider-name>'. It gives a uniform error surface across all AI providers.","triggerScenarios":"Calling generateCompletion() on any provider (ZAI, OpenAI-compatible, Anthropic, Ollama, etc.) whose internal HTTP/API call throws — e.g. invalid API key, network timeout, rate limit, malformed request, model not found.","commonSituations":"Missing or expired API key in env/config; unreachable local provider (Ollama not running); rate limiting during burst usage; wrong model name; proxy/firewall blocking outbound HTTPS.","solutions":["Read the inner message after 'provider error:' — it contains the underlying cause; fix that first","Verify the provider's API key/credentials are set and valid (env vars or tm config)","If network-related, check connectivity/proxy settings and retry","Confirm the requested model name exists for the configured provider","Catch TaskMasterError and inspect its code/details for provider-specific handling"],"exampleFix":"// before\nconst result = await provider.generateCompletion(prompt); // unhandled\n// after\ntry {\n  const result = await provider.generateCompletion(prompt);\n} catch (e) {\n  if (e instanceof TaskMasterError && e.details?.resource === 'zai') {\n    console.error('ZAI provider failed:', e.message);\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// before calling: ensure provider is configured\nif (!providerConfig.apiKey) throw new Error('Provider API key missing');","typeGuard":"function isTaskMasterError(e: unknown): e is TaskMasterError {\n  return e instanceof TaskMasterError;\n}","tryCatchPattern":"try {\n  const res = await provider.generateCompletion(prompt);\n} catch (e) {\n  if (e instanceof TaskMasterError) {\n    // e.code, e.details.operation, e.details.resource identify the provider failure\n    logger.error(`${e.details?.resource}: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Validate API keys and model names before calling generateCompletion","Set explicit timeouts and retry with backoff for transient network failures","Monitor rate limits for the configured provider","Keep the provider package/config in sync with the backend's supported models"],"tags":["ai-provider","http","error-wrapping"],"backgroundTag":"ai-provider-request-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}