{"record":{"id":"3231154e33e5dc7f","repo":"bytedance/deer-flow","slug":"selected-history-entry-has-no-previous-content-to","errorCode":null,"errorMessage":"Selected history entry has no previous content to roll back to","messagePattern":"Selected history entry has no previous content to roll back to","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"backend/app/gateway/routers/skills.py","lineNumber":373,"sourceCode":"    except Exception as e:\n        logger.error(\"Failed to read history for %s: %s\", skill_name, e, exc_info=True)\n        raise HTTPException(status_code=500, detail=f\"Failed to read history: {str(e)}\")\n\n\n@router.post(\"/skills/custom/{skill_name}/rollback\", response_model=CustomSkillContentResponse, summary=\"Rollback Custom Skill\")\nasync def rollback_custom_skill(skill_name: str, body: SkillRollbackRequest, request: Request, config: AppConfig = Depends(get_config)) -> CustomSkillContentResponse:\n    await require_admin_user(request, detail=_ADMIN_REQUIRED_DETAIL)\n    try:\n        storage = _get_user_skill_storage(config)\n        if not storage.custom_skill_exists(skill_name) and not storage.get_skill_history_file(skill_name).exists():\n            raise HTTPException(status_code=404, detail=f\"Custom skill '{skill_name}' not found\")\n        history = storage.read_history(skill_name)\n        if not history:\n            raise HTTPException(status_code=400, detail=f\"Custom skill '{skill_name}' has no history\")\n        record = history[body.history_index]\n        target_content = record.get(\"prev_content\")\n        if target_content is None:\n            raise HTTPException(status_code=400, detail=\"Selected history entry has no previous content to roll back to\")\n        storage.validate_skill_markdown_content(skill_name, target_content)\n        static_findings = await _scan_static_skill_markdown_or_raise(skill_name, target_content, app_config=config)\n        scan = await scan_skill_content(target_content, executable=False, location=f\"{skill_name}/{SKILL_MD_FILE}\", app_config=config, static_findings=static_findings)\n        skill_file = storage.get_custom_skill_file(skill_name)\n        current_content = skill_file.read_text(encoding=\"utf-8\") if skill_file.exists() else None\n        history_entry = {\n            \"action\": \"rollback\",\n            \"author\": \"human\",\n            \"thread_id\": None,\n            \"file_path\": SKILL_MD_FILE,\n            \"prev_content\": current_content,\n            \"new_content\": target_content,\n            \"rollback_from_ts\": record.get(\"ts\"),\n            \"scanner\": {\"decision\": scan.decision, \"reason\": scan.reason, \"static_findings\": static_findings},\n        }\n        if scan.decision == \"block\":\n            await asyncio.to_thread(storage.append_history, skill_name, history_entry)\n            raise HTTPException(status_code=400, detail=f\"Rollback blocked by security scanner: {scan.reason}\")","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/skills.py#L355-L391","documentation":"Error \"Selected history entry has no previous content to roll back to\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/app/gateway/routers/skills.py:373 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a history entry that has previous content (not the earliest snapshot).","Save a new version of the skill first, then roll back to it."],"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"}