claude-code - 💡(How to fix) Fix Data loss caused by Claude Code desktop organization script [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56301Fetched 2026-05-06 06:31:44
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2closed ×1
RAW_BUFFERClick to expand / collapse

사고 요약

Claude Code (claude-sonnet-4-6)가 바탕화면 파일 정리 작업을 수행하던 중 PowerShell 스크립트의 한글(Korean) 경로 인코딩 처리 오류로 인해 사용자의 중요 파일들이 영구 삭제되는 사고가 발생했습니다.

발생 경위

  1. 사용자가 바탕화면 정리를 요청
  2. Claude가 PowerShell 스크립트를 작성하여 카테고리별 폴더 생성 후 파일 이동 시도
  3. UTF-8 BOM 인코딩 문제로 이 실제 한글 경로와 다른 위치에 폴더를 생성
  4. 명령이 폴더 이동이 아닌 파일 덮어쓰기 방식으로 동작
  5. 각 카테고리별 마지막 파일만 남고 나머지 수십 개 파일이 영구 삭제

피해 내용

  • 개인정보보호 업무 문서 (PDF, HWP 등 약 20개 이상)
  • 업무 프로젝트 파일 (PPT, XLS 등)
  • 자격증 학습 교재 (CISA, CPPG, NCS 등 고가 자료 포함)
  • 취업/이력서 관련 서류 (자기소개서, 포트폴리오 등)
  • 개인 재무 서류 (개인회생결정서 등 법적 문서 포함)
  • 사진 및 미디어 파일

Shadow Copy, OneDrive, 파일 히스토리 백업 없음 확인됨.

근본 원인

  • PowerShell에서 한글 경로를 포함한 스크립트 실행 시 인코딩 불일치 미검증
  • 사용 전 목적지가 유효한 디렉토리인지 확인하는 검증 로직 부재
  • 스크립트 실행 전 테스트 없이 실제 파일에 바로 적용

개선 요청

  1. 파일 시스템 작업 전 반드시 목적지 경로 유효성 검증 로직 추가
  2. 플래그 사용 시 사용자 확인 절차 강화
  3. 비ASCII(한글, 중국어 등) 경로 처리 시 인코딩 사전 검증
  4. 파일 삭제/이동 등 비가역적 작업 전 사용자 승인 요구 강화
  5. 피해 사용자에 대한 크레딧 보상 검토 요청

환경

  • OS: Windows 11 Pro 10.0.26200
  • Shell: PowerShell
  • Model: claude-sonnet-4-6
  • Date: 2026-05-05

extent analysis

TL;DR

To prevent similar incidents, add a validation check for the destination path's validity and encoding before executing file system operations in PowerShell scripts.

Guidance

  • Verify the destination path's existence and validity before moving or deleting files to prevent unintended data loss.
  • Implement a user confirmation step before executing irreversible file operations, such as deletion or overwriting.
  • Use encoding validation for non-ASCII paths, including Korean characters, to ensure correct path interpretation.
  • Consider adding a dry-run or simulation mode to test scripts before applying them to actual files.

Example

# Example of path validation
$destinationPath = "C:\path\with\korean\characters"
if (Test-Path -Path $destinationPath) {
    # Path exists, proceed with file operation
} else {
    # Path does not exist, handle error or create directory
}

Notes

The provided information suggests a lack of validation and testing in the PowerShell script, leading to the data loss incident. The suggested improvements focus on adding validation and user confirmation steps to prevent similar incidents in the future.

Recommendation

Apply workaround: Implement the suggested validation and confirmation steps in the PowerShell script to prevent data loss due to incorrect path handling or unintended file operations. This approach addresses the root cause of the incident and provides a more robust and safe file management process.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING