Skip to content

Commit f5b559b

Browse files
committed
handle 409
1 parent 2eb247b commit f5b559b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sentience/tracer_factory.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ def _recover_orphaned_traces(api_key: str, api_url: str = SENTIENCE_API_URL) ->
208208
)
209209

210210
if response.status_code != 200:
211+
# HTTP 409 means trace already exists (already uploaded)
212+
# Treat as success and delete local file
213+
if response.status_code == 409:
214+
print(f"✅ Trace {run_id} already exists in cloud (skipping re-upload)")
215+
# Delete local file since it's already in cloud
216+
try:
217+
os.remove(trace_file)
218+
except Exception:
219+
pass # Ignore cleanup errors
220+
continue
211221
# HTTP 422 typically means invalid run_id (e.g., test files)
212222
# Skip silently for 422, but log other errors
213223
if response.status_code == 422:

0 commit comments

Comments
 (0)