{"record":{"id":"90d154334806d9e3","repo":"bytedance/deer-flow","slug":"backend-unreachable","errorCode":"backend_unreachable","errorMessage":"Could not reach the DeerFlow backend.","messagePattern":"Could not reach the DeerFlow backend\\.","errorType":"exception","errorClass":"AgentNameCheckError","httpStatus":null,"severity":"error","filePath":"frontend/src/core/agents/api.ts","lineNumber":100,"sourceCode":"}\n\nexport async function deleteAgent(name: string): Promise<void> {\n  const res = await fetch(`${getBackendBaseURL()}/api/agents/${name}`, {\n    method: \"DELETE\",\n  });\n  if (!res.ok) throw new Error(`Failed to delete agent: ${res.statusText}`);\n}\n\nexport async function checkAgentName(\n  name: string,\n): Promise<{ available: boolean; name: string }> {\n  let res: Response;\n  try {\n    res = await fetch(\n      `${getBackendBaseURL()}/api/agents/check?name=${encodeURIComponent(name)}`,\n    );\n  } catch {\n    throw new AgentNameCheckError(\n      \"Could not reach the DeerFlow backend.\",\n      \"backend_unreachable\",\n    );\n  }\n\n  if (!res.ok) {\n    const err = (await res.json().catch(() => ({}))) as { detail?: string };\n    if (isAgentsApiDisabledDetail(err.detail)) {\n      throw new AgentsApiDisabledError(err.detail!);\n    }\n    if (BACKEND_UNAVAILABLE_STATUSES.has(res.status)) {\n      throw new AgentNameCheckError(\n        \"Could not reach the DeerFlow backend.\",\n        \"backend_unreachable\",\n      );\n    }\n    const backendDetail = typeof err.detail === \"string\" ? err.detail : null;\n    throw new AgentNameCheckError(","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/frontend/src/core/agents/api.ts#L82-L118","documentation":"Raised when the openviking api_key_env setting resolves to an empty string after strip(). api_key_env names the environment variable holding the USER API key (default OPENVIKING_API_KEY); an explicitly empty value means the config can never tell you which variable to export, so it fails fast before the environment is even consulted.","triggerScenarios":"Setting api_key_env: '' (or a whitespace-only value, or a template expansion like ${OV_KEY:-} that collapses to empty) in the openviking backend_config. The check runs during from_backend_config, so exporting the key does not help until the name is fixed.","commonSituations":"Templated YAML where an optional variable collapses to an empty string; deleting a value but leaving the key; copy-paste config where a placeholder was never filled in.","solutions":["Set api_key_env to a real variable name, e.g. api_key_env: OPENVIKING_API_KEY.","Or delete the api_key_env line entirely to accept the default OPENVIKING_API_KEY.","If templating produced the empty value, fix the template so unset expansions fail loudly instead of collapsing to ''."],"exampleFix":"# before\nbackend_config:\n  api_key_env: ''\n\n# after\nbackend_config:\n  api_key_env: OPENVIKING_API_KEY","handlingStrategy":"validation","validationCode":"def check_api_key_env(value: str) -> str:\n    name = value.strip()\n    assert name, 'api_key_env must be a non-empty environment variable name'\n    return name","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use templating defaults that fail or omit the key instead of expanding unset variables to empty strings.","Omit api_key_env entirely when you want the default OPENVIKING_API_KEY.","Lint config for empty-string values before deploy."],"tags":["openviking","configuration","validation","environment"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}