{"record":{"id":"61a4770fce17d01c","repo":"dutchcoders/transfer.sh","slug":"metadata-doesn-t-exist","errorCode":null,"errorMessage":"metadata doesn't exist","messagePattern":"metadata doesn't exist","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/handlers.go","lineNumber":916,"sourceCode":"\t\t} else if err := s.storage.Put(ctx, token, fmt.Sprintf(\"%s.metadata\", filename), buffer, \"text/json\", uint64(buffer.Len())); err != nil {\n\t\t\treturn metadata, errors.New(\"could not save metadata\")\n\t\t}\n\t}\n\n\treturn metadata, nil\n}\n\nfunc (s *Server) checkDeletionToken(ctx context.Context, deletionToken, token, filename string) error {\n\ts.lock(token, filename)\n\tdefer s.unlock(token, filename)\n\n\tvar metadata metadata\n\n\tr, _, err := s.storage.Get(ctx, token, fmt.Sprintf(\"%s.metadata\", filename), nil)\n\tdefer storage.CloseCheck(r)\n\n\tif s.storage.IsNotExist(err) {\n\t\treturn errors.New(\"metadata doesn't exist\")\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\tif err := json.NewDecoder(r).Decode(&metadata); err != nil {\n\t\treturn err\n\t} else if metadata.DeletionToken != deletionToken {\n\t\treturn errors.New(\"deletion token doesn't match\")\n\t}\n\n\treturn nil\n}\n\nfunc (s *Server) purgeHandler() {\n\tticker := time.NewTicker(s.purgeInterval)\n\tgo func() {\n\t\tfor {\n\t\t\t<-ticker.C","sourceCodeStart":898,"sourceCodeEnd":934,"githubUrl":"https://github.com/dutchcoders/transfer.sh/blob/c37bfd95797fd6da8a6da53fc13d191994b3f687/server/handlers.go#L898-L934","documentation":"checkDeletionToken (used by deleteHandler to authenticate deletes) first fetches the stored <filename>.metadata object. If storage reports the object does not exist (IsNotExist), the server returns this error. It means there is no metadata for the given token/filename, so the deletion request cannot be validated.","triggerScenarios":"DELETE request with a deletion token for a token/filename combination whose .metadata object was never created (upload without metadata), already purged, or where the filename/token in the delete URL is wrong.","commonSituations":"Deleting a file uploaded by a transfer.sh version/flow that didn't write metadata; file already deleted or expired and purged; typo in token or filename in the delete URL; purger job removed the metadata but not the data.","solutions":["Verify the delete URL uses the exact token and filename from the original upload.","Check whether the file was already deleted or expired (purged) — if so there is nothing to delete.","Re-upload if you still need a deletable object, and use the new token/deletionToken pair.","Inspect the storage backend to confirm whether <token>/<filename>.metadata exists; if the purger left orphaned data, clean it manually."],"exampleFix":"// before\ncurl -X DELETE https://host/wrongtoken/file.txt -H 'X-Url-Delete: abc'\n// after\ncurl -X DELETE https://host/<correct-token>/file.txt -H 'X-Url-Delete: <matching-deletion-token>'","handlingStrategy":"validation","validationCode":"// confirm the object exists before issuing DELETE\nresp, _ := http.Head(fmt.Sprintf(\"https://host/%s/%s\", token, filename))\nif resp.StatusCode == http.StatusNotFound {\n\t// nothing to delete; skip DELETE call\n}","typeGuard":null,"tryCatchPattern":"resp, err := doDelete(token, file, delToken)\nif err == nil && resp.StatusCode != http.StatusOK {\n\tb, _ := io.ReadAll(resp.Body)\n\tif strings.Contains(string(b), \"metadata doesn't exist\") {\n\t\t// already gone or wrong token/filename; treat as idempotent success or fix URL\n\t}\n}","preventionTips":["Persist the exact token, filename and deletion token returned at upload time.","Check for prior deletion/expiry before deleting programmatically.","Treat DELETE 4xx as idempotent where possible."],"tags":["metadata","delete","not-found","storage"],"backgroundTag":"resource-not-found","analyzedSha":"c37bfd95797fd6da8a6da53fc13d191994b3f687","analyzedAt":"2026-09-05T10:21:07.548Z","contentChangedAt":"2026-09-05T10:21:07.548Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}