{"record":{"id":"9679c34cf3f9f2ba","repo":"abhigyanpatwari/GitNexus","slug":"minimax-api-key-is-required-but-was-not-provided","errorCode":null,"errorMessage":"MiniMax API key is required but was not provided","messagePattern":"MiniMax API key is required but was not provided","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus-web/src/core/llm/agent.ts","lineNumber":278,"sourceCode":"      return new ChatOpenAI({\n        openAIApiKey: openRouterConfig.apiKey,\n        apiKey: openRouterConfig.apiKey, // Fallback for some versions\n        modelName: openRouterConfig.model,\n        temperature: openRouterConfig.temperature ?? 0.1,\n        maxTokens: openRouterConfig.maxTokens,\n        configuration: {\n          apiKey: openRouterConfig.apiKey, // Ensure client receives it\n          baseURL: openRouterConfig.baseUrl ?? DEFAULT_OPENROUTER_BASE_URL,\n        },\n        streaming: true,\n      });\n    }\n\n    case 'minimax': {\n      const minimaxConfig = config as MiniMaxConfig;\n\n      if (!minimaxConfig.apiKey || minimaxConfig.apiKey.trim() === '') {\n        throw new Error('MiniMax API key is required but was not provided');\n      }\n\n      const capabilities = getMiniMaxModelCapabilities(minimaxConfig.model);\n      const requestedThinkingMode = minimaxConfig.thinkingMode;\n      const thinkingMode: MiniMaxThinkingMode | undefined =\n        requestedThinkingMode && capabilities?.thinkingModes.includes(requestedThinkingMode)\n          ? requestedThinkingMode\n          : (capabilities?.thinkingModes[0] ?? requestedThinkingMode);\n      const thinking =\n        thinkingMode && thinkingMode !== 'always_on' ? { type: thinkingMode } : undefined;\n      const temperature =\n        thinkingMode === 'adaptive' || thinkingMode === 'always_on'\n          ? undefined\n          : (minimaxConfig.temperature ?? 0.1);\n\n      return new ChatAnthropic({\n        anthropicApiKey: minimaxConfig.apiKey,\n        model: minimaxConfig.model,","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus-web/src/core/llm/agent.ts#L260-L296","documentation":"Thrown by createChatModel() in the 'minimax' provider branch when minimaxConfig.apiKey is falsy or whitespace-only. MiniMax is accessed through a ChatAnthropic wrapper pointed at the MiniMax Anthropic-compatible endpoint (MINIMAX_ANTHROPIC_BASE_URLS.global_en by default); the key is required to construct the client. After this guard, model capability/thinking-mode normalization proceeds.","triggerScenarios":"Calling createChatModel({ provider: 'minimax', apiKey: undefined | '' | '   ', model: 'MiniMax-M3', ... }).","commonSituations":"The MiniMax key wasn't provisioned in settings; using a CN-region key against the global endpoint without setting baseUrl; switching to minimax provider without an account on platform.minimax.io.","solutions":["Obtain a key from platform.minimax.io and enter it in provider settings","Ensure the key is non-empty and non-whitespace","If using the CN endpoint, set baseUrl to MINIMAX_ANTHROPIC_BASE_URLS.cn_zh","Recreate the agent after setting the key (construction-time check)"],"exampleFix":"// before\ncreateChatModel({ provider: 'minimax', apiKey: '', model: 'MiniMax-M3' }); // throws\n\n// after\ncreateChatModel({ provider: 'minimax', apiKey: userKey, model: 'MiniMax-M3' });","handlingStrategy":"validation","validationCode":"function hasMiniMaxKey(cfg: { apiKey?: string }): boolean {\n  return typeof cfg.apiKey === 'string' && cfg.apiKey.trim().length > 0;\n}\nif (cfg.provider === 'minimax' && !hasMiniMaxKey(cfg)) {\n  throw new Error('Configure a MiniMax API key (from platform.minimax.io)');\n}","typeGuard":"function isMiniMaxConfigReady(cfg: unknown): cfg is { provider: 'minimax'; apiKey: string; model: string } {\n  return typeof cfg === 'object' && cfg !== null\n    && (cfg as any).provider === 'minimax'\n    && typeof (cfg as any).apiKey === 'string'\n    && (cfg as any).apiKey.trim().length > 0;\n}","tryCatchPattern":"try {\n  createChatModel({ provider: 'minimax', apiKey, model });\n} catch (e) {\n  if (e instanceof Error && /MiniMax API key is required/.test(e.message)) {\n    promptUserForKey('minimax');\n    return;\n  }\n  throw e;\n}","preventionTips":["Obtain keys from platform.minimax.io (global) or platform.minimaxi.com (CN)","Set baseUrl to MINIMAX_ANTHROPIC_BASE_URLS.cn_zh if using the CN endpoint","Pick a supported model id from MINIMAX_MODEL_IDS so capability lookup succeeds","Re-create the agent after entering the key (construction-time check)"],"tags":["llm","minimax","config","api-key"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}