langgenius/dify · warning · TracingConfigNotExist
trace_config_not_exist
trace_config_not_exist
Error message
Trace config not exist.
What it means
Raised as TracingConfigNotExist in PATCH /apps/{app_id}/ops-trace when OpsService.update_tracing_app_config returns a falsy result (api/controllers/console/app/ops_trace.py:151-152). The service returns falsy when no existing tracing config for the given app+provider is found to update. The outer handler surfaces it as BadRequest(400) with message 'Trace config not exist.'
Source
Thrown at api/controllers/console/app/ops_trace.py:152
@console_ns.response(403, "Insufficient permissions")
@setup_required
@login_required
@account_initialization_required
@edit_permission_required
@rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_TRACING_CONFIG)
@get_app_model
@model_validate(TraceConfigPayload)
def patch(self, req_data: TraceConfigPayload, app_model: App):
"""Update an existing trace app configuration"""
try:
result = OpsService.update_tracing_app_config(
app_id=app_model.id,
tracing_provider=req_data.tracing_provider,
tracing_config=req_data.tracing_config,
session=db.session(),
)
if not result:
raise TracingConfigNotExist()
return {"result": "success"}
except Exception as e:
raise BadRequest(str(e))
@console_ns.doc("delete_trace_app_config")
@console_ns.doc(description="Delete an existing tracing configuration for an application")
@console_ns.doc(params={"app_id": "Application ID"})
@console_ns.doc(params=query_params_from_model(TraceProviderQuery))
@console_ns.response(204, "Tracing configuration deleted successfully")
@console_ns.response(400, "Invalid request parameters or configuration not found")
@console_ns.response(403, "Insufficient permissions")
@setup_required
@login_required
@account_initialization_required
@edit_permission_required
@rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_TRACING_CONFIG)
@get_app_model
@model_validate(TraceProviderQuery)View on GitHub (pinned to ef8544b173)
Solutions
- POST the config first to create it, then PATCH for subsequent updates.
- If the config was deleted, recreate via POST.
- Ensure the tracing_provider in the PATCH payload matches an existing stored config.
- Refresh the trace-config view before editing to confirm it still exists.
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure a config exists before PATCHing
const existing = await fetch(`/apps/${appId}/ops-trace?provider=${provider}`).then(r=>r.ok?r.json():null)
if (!existing) await createTraceConfig(appId, payload)
else await patchTraceConfig(appId, payload) Try / catch
try {
await patchTraceConfig(appId, payload)
} catch (e) {
if (e.code === 'trace_config_not_exist') return createTraceConfig(appId, payload)
throw e
} Prevention
- Refresh the trace-config view before editing.
- Choose POST/PATCH based on current existence, not assumption.
When it happens
Trigger: PATCHing a trace config for an app+provider that has no stored config — update-before-create. The endpoint requires the config to already exist.
Common situations: Front-end calling PATCH on first save instead of POST; config was deleted between load and save; provider mismatch between the loaded config and the PATCH payload; race with another admin deleting the config.
Related errors
- trace_config_is_exist
- trace_config_check_error
- draft_workflow_not_exist
- completion_request_error
- app_suggested_questions_after_answer_disabled
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/c2f48cb49e697550.
Report an issue: GitHub.