{"record":{"id":"caa675116add3937","repo":"iflytek/astron-agent","slug":"auth-name-auth-name-auth-value-auth-value","errorCode":null,"errorMessage":"auth name:{auth_name}, auth value:{auth_value}","messagePattern":"auth name:(.+?), auth value:(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"core/plugin/link/service/community/tools/http/execution_server.py","lineNumber":220,"sourceCode":"def process_authentication(\n    operation_id_schema: Dict[str, Any],\n    message_header: Dict[str, Any],\n    message_query: Dict[str, Any],\n    tool_id: str,\n) -> None:\n    \"\"\"Process authentication for the request.\"\"\"\n    if not operation_id_schema[\"security\"]:\n        return\n\n    security_type = operation_id_schema[\"security_type\"]\n    if security_type not in operation_id_schema[\"security\"]:\n        raise Exception(f\"Security type {security_type} not found in security schema\")\n\n    api_key_info = operation_id_schema[\"security\"].get(security_type)\n    auth_name = api_key_info.get(\"name\", None)\n    auth_value = api_key_info.get(\"x-value\", None)\n    if not auth_name or not auth_value:\n        raise Exception(f\"auth name:{auth_name}, auth value:{auth_value}\")\n\n    if api_key_info.get(\"type\") == \"apiKey\":\n        api_key_dict = {auth_name: auth_value}\n        if api_key_info.get(\"in\") == \"header\":\n            message_header.update(api_key_dict)\n        elif api_key_info.get(\"in\") == \"query\":\n            message_query.update(api_key_dict)\n\n\ndef validate_response_schema(  # noqa: C901\n    result_json: Any, open_api_schema: Dict[str, Any]\n) -> List[str]:\n    \"\"\"Validate response against schema and return error messages.\"\"\"\n    response_schema = get_response_schema(open_api_schema)\n    er_msgs: List[str] = []\n\n    import jsonschema\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/link/service/community/tools/http/execution_server.py#L202-L238","documentation":"Generic Exception raised when the API-key security entry exists but lacks a usable name or x-value. process_authentication requires both auth_name (the credential parameter name) and auth_value (the configured key) to inject the credential into header/query/cookie.","triggerScenarios":"handle_request_execution -> process_authentication where operation_id_schema['security'][security_type] is missing 'name' or 'x-value', or where either is present but empty/None (falsy).","commonSituations":"Tool author left the x-value placeholder empty when publishing the community tool; schema import dropped the extension; values stored with wrong keys after a schema format change.","solutions":["Re-publish/update the tool supplying both the auth parameter name and x-value.","Inspect the stored security entry (print api_key_info) to confirm which key is missing.","Add validation at tool registration time so tools without complete credentials are rejected before execution.","Use distinct error messages for missing name vs missing value to speed diagnosis."],"exampleFix":"// before\nauth_name = api_key_info.get(\"name\", None)\nauth_value = api_key_info.get(\"x-value\", None)\nif not auth_name or not auth_value:\n    raise Exception(f\"auth name:{auth_name}, auth value:{auth_value}\")\n// after\nif not api_key_info.get(\"name\"):\n    raise ToolAuthConfigError(f\"tool {tool_id}: security scheme missing 'name'\")\nif not api_key_info.get(\"x-value\"):\n    raise ToolAuthConfigError(f\"tool {tool_id}: security scheme missing 'x-value'\")","handlingStrategy":"validation","validationCode":"def has_credentials(api_key_info: dict) -> bool:\n    return bool(api_key_info.get(\"name\")) and bool(api_key_info.get(\"x-value\"))","typeGuard":"def is_complete_api_key(info) -> bool:\n    return isinstance(info, dict) and isinstance(info.get(\"name\"), str) and bool(info.get(\"x-value\"))","tryCatchPattern":"try:\n    process_authentication(schema, headers)\nexcept Exception as e:\n    return error_response(422, f\"missing API key credentials: {e}\")","preventionTips":["Require name and x-value in the tool publish form","Validate credentials at registration, not per-request","Keep auth metadata out of hand-edited schema files"],"tags":["authentication","api-key","openapi","missing-credentials"],"backgroundTag":"missing-credentials","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}