{"record":{"id":"df27ccb19d1509d4","repo":"hsliuping/TradingAgents-CN","slug":"volcengine-coding-api-key","errorCode":null,"errorMessage":"使用火山方舟编程需要设置VOLCENGINE_CODING_API_KEY环境变量","messagePattern":"使用火山方舟编程需要设置VOLCENGINE_CODING_API_KEY环境变量","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"tradingagents/graph/trading_graph.py","lineNumber":311,"sourceCode":"                api_key = os.getenv('SILICONFLOW_API_KEY')\n                if not api_key:\n                    raise ValueError(\"使用SiliconFlow需要设置SILICONFLOW_API_KEY环境变量\")\n            elif provider == \"openrouter\":\n                api_key = os.getenv('OPENROUTER_API_KEY') or os.getenv('OPENAI_API_KEY')\n                if not api_key:\n                    raise ValueError(\"使用OpenRouter需要设置OPENROUTER_API_KEY或OPENAI_API_KEY环境变量\")\n            elif provider == \"aihubmix\":\n                api_key = os.getenv('AIHUBMIX_API_KEY')\n                if not api_key:\n                    raise ValueError(\"使用AiHubMix需要设置AIHUBMIX_API_KEY环境变量\")\n            elif provider == \"volcengine\":\n                api_key = os.getenv('VOLCENGINE_API_KEY') or os.getenv('ARK_API_KEY')\n                if not api_key:\n                    raise ValueError(\"使用火山方舟需要设置VOLCENGINE_API_KEY或ARK_API_KEY环境变量\")\n            elif provider == \"volcengine_coding\":\n                api_key = os.getenv('VOLCENGINE_CODING_API_KEY')\n                if not api_key:\n                    raise ValueError(\"使用火山方舟编程需要设置VOLCENGINE_CODING_API_KEY环境变量\")\n\n            self.deep_thinking_llm, self.quick_thinking_llm = _create_provider_pair(\n                provider=provider,\n                config=self.config,\n                quick_temperature=quick_temperature,\n                quick_max_tokens=quick_max_tokens,\n                quick_timeout=quick_timeout,\n                deep_temperature=deep_temperature,\n                deep_max_tokens=deep_max_tokens,\n                deep_timeout=deep_timeout,\n                backend_url=self.config[\"backend_url\"],\n                api_key=api_key,\n                quick_extra_kwargs=_quick_extra if _quick_extra else None,\n                deep_extra_kwargs=_deep_extra if _deep_extra else None,\n            )\n        elif normalized_provider == \"anthropic\":\n            from langchain_anthropic import ChatAnthropic\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/hsliuping/TradingAgents-CN/blob/74783e8817d6cf6de29867880631cc555153f36b/tradingagents/graph/trading_graph.py#L293-L329","documentation":"TradingAgentsGraph.__init__ raises this when provider is 'volcengine_coding' and VOLCENGINE_CODING_API_KEY is unset. This is the separate Volcengine coding-plan credential, distinct from the general Ark key. Raised during LLM client pair creation at graph construction.","triggerScenarios":"llm_provider=\"volcengine_coding\" in config without VOLCENGINE_CODING_API_KEY exported in the running process.","commonSituations":"User set VOLCENGINE_API_KEY thinking it covers the coding plan tier; env var missing in containerized deployment; typo in variable name.","solutions":["export VOLCENGINE_CODING_API_KEY=<coding-plan-key>","Ensure .env / compose environment includes it and dotenv loads before graph init","Confirm your Volcengine account actually has a coding-plan key — a regular ARK key will not be accepted here"],"exampleFix":"# before\n# only VOLCENGINE_API_KEY set\ngraph = TradingAgentsGraph(config={\"llm_provider\": \"volcengine_coding\"})\n\n# after\n# export VOLCENGINE_CODING_API_KEY=<coding-key>\ngraph = TradingAgentsGraph(config={\"llm_provider\": \"volcengine_coding\"})","handlingStrategy":"validation","validationCode":"import os\nif provider == \"volcengine_coding\" and not os.getenv(\"VOLCENGINE_CODING_API_KEY\"):\n    raise SystemExit(\"Set VOLCENGINE_CODING_API_KEY (coding-plan credential)\")","typeGuard":"def has_volcengine_coding_key() -> bool:\n    return bool(os.getenv(\"VOLCENGINE_CODING_API_KEY\"))","tryCatchPattern":"try:\n    graph = TradingAgentsGraph(config=cfg)\nexcept ValueError as e:\n    if \"VOLCENGINE_CODING_API_KEY\" in str(e):\n        raise SystemExit(\"Provision coding-plan key\") from e\n    raise","preventionTips":["Document that coding-plan keys differ from general Ark keys","Namespace secrets clearly in your secret store","Preflight-check the exact env name for the chosen provider"],"tags":["api-key","missing-env-var","volcengine","coding-plan","llm"],"backgroundTag":"missing-api-key","analyzedSha":"74783e8817d6cf6de29867880631cc555153f36b","analyzedAt":"2026-08-28T11:39:07.729Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}