{"record":{"id":"33c041153d706b7d","repo":"bytedance/deer-flow","slug":"failed-to-clear-thread-goal","errorCode":null,"errorMessage":"Failed to clear thread goal","messagePattern":"Failed to clear thread goal","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"backend/app/gateway/routers/threads.py","lineNumber":1128,"sourceCode":"        raise HTTPException(status_code=500, detail=\"Failed to set thread goal\") from None\n    return ThreadGoalResponse(goal=goal)\n\n\n@router.delete(\"/{thread_id}/goal\", response_model=ThreadGoalResponse)\n@require_permission(\"threads\", \"write\", owner_check=True)\nasync def clear_thread_goal(thread_id: ThreadId, request: Request) -> ThreadGoalResponse:\n    \"\"\"Clear the active goal for a thread.\"\"\"\n    checkpointer = get_checkpointer(request)\n    try:\n        async with reserve_checkpoint_write(request, thread_id, user_id=get_effective_user_id()):\n            await write_thread_goal(checkpointer, thread_id, None, as_node=\"goal\")\n    except ConflictError:\n        raise HTTPException(status_code=409, detail=\"Thread has a run in flight. Clear the goal after the run finishes.\") from None\n    except LookupError:\n        return ThreadGoalResponse(goal=None)\n    except Exception:\n        logger.exception(\"Failed to clear goal for thread %s\", sanitize_log_param(thread_id))\n        raise HTTPException(status_code=500, detail=\"Failed to clear thread goal\") from None\n    return ThreadGoalResponse(goal=None)\n\n\ndef _thread_compact_response(result: ThreadCompactionResult) -> ThreadCompactResponse:\n    return ThreadCompactResponse(\n        thread_id=result.thread_id,\n        compacted=result.compacted,\n        reason=result.reason,\n        removed_message_count=result.removed_message_count,\n        preserved_message_count=result.preserved_message_count,\n        summary_updated=result.summary_updated,\n        checkpoint_id=result.checkpoint_id,\n        total_tokens=result.total_tokens,\n    )\n\n\n@router.post(\"/{thread_id}/compact\", response_model=ThreadCompactResponse)\n@require_permission(\"threads\", \"write\", owner_check=True, require_existing=True)","sourceCodeStart":1110,"sourceCodeEnd":1146,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/threads.py#L1110-L1146","documentation":"Error \"Failed to clear thread goal\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/app/gateway/routers/threads.py:1128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the Gateway logs for the underlying failure.","Verify the thread exists and has a goal set, then retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}