{"record":{"id":"2eae7f726f014fda","repo":"langgenius/dify","slug":"trace-config-check-error","errorCode":"trace_config_check_error","errorMessage":"Invalid Credentials.","messagePattern":"Invalid Credentials\\.","errorType":"error_code","errorClass":"TracingConfigCheckError","httpStatus":400,"severity":"error","filePath":"api/controllers/console/app/ops_trace.py","lineNumber":119,"sourceCode":"    @login_required\n    @account_initialization_required\n    @edit_permission_required\n    @rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_TRACING_CONFIG)\n    @get_app_model\n    @model_validate(TraceConfigPayload)\n    def post(self, req_data: TraceConfigPayload, app_model: App):\n        \"\"\"Create a new trace app configuration\"\"\"\n        try:\n            result = OpsService.create_tracing_app_config(\n                app_id=app_model.id,\n                tracing_provider=req_data.tracing_provider,\n                tracing_config=req_data.tracing_config,\n                session=db.session(),\n            )\n            if not result:\n                raise TracingConfigIsExist()\n            if result.get(\"error\"):\n                raise TracingConfigCheckError()\n            return result\n        except Exception as e:\n            raise BadRequest(str(e))\n\n    @console_ns.doc(\"update_trace_app_config\")\n    @console_ns.doc(description=\"Update an existing tracing configuration for an application\")\n    @console_ns.doc(params={\"app_id\": \"Application ID\"})\n    @console_ns.expect(console_ns.models[TraceConfigPayload.__name__])\n    @console_ns.response(\n        200,\n        \"Tracing configuration updated successfully\",\n        console_ns.models[TraceAppConfigResponse.__name__],\n    )\n    @console_ns.response(400, \"Invalid request parameters or configuration not found\")\n    @console_ns.response(403, \"Insufficient permissions\")\n    @setup_required\n    @login_required\n    @account_initialization_required","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/ops_trace.py#L101-L137","documentation":"Raised as TracingConfigCheckError when OpsService.create_tracing_app_config returns a dict whose 'error' key is truthy (api/controllers/console/app/ops_trace.py:118-119). The service validates the supplied tracing credentials against the provider (e.g. LangSmith/LangFire) and returns an error if authentication or connectivity fails. The outer handler re-raises it as BadRequest(400) with 'Invalid Credentials.' as the message.","triggerScenarios":"POSTing a trace config with an invalid API key/token, wrong project/organization identifier, or when the tracing provider endpoint is unreachable. The service attempts a real check call to the provider and propagates the failure.","commonSituations":"Typo in the API key; expired/revoked provider token; wrong project name; provider-side outage during the check; missing required field (e.g. tenant slug) for the chosen provider.","solutions":["Verify the tracing provider API key/token is correct and active in the provider's dashboard.","Confirm the project/organization fields required by the chosen provider are filled and valid.","Test the credentials directly against the provider API (e.g. a curl to LangSmith) to isolate Dify-side vs. provider-side issues.","Retry after confirming the provider service is reachable from the Dify backend host."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate credentials by calling the provider directly (example: LangSmith)\n// Or rely on a 'test connection' affordance before saving\nconst ok = await testProviderCredentials(payload.tracing_provider, payload.tracing_config)\nif (!ok) throw new Error('invalid credentials')\nawait createTraceConfig(appId, payload)","typeGuard":null,"tryCatchPattern":"try {\n  await createTraceConfig(appId, payload)\n} catch (e) {\n  if (e.code === 'trace_config_check_error') showFieldError('api_key', 'Invalid credentials')\n  throw e\n}","preventionTips":["Offer a 'Test connection' button that hits the provider before save.","Trim and validate API key format client-side.","Keep provider-specific required-field lists in sync with the backend."],"tags":["ops-trace","tracing-config","invalid-credentials","api"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}