{"record":{"id":"50f5dec40cc95f40","repo":"JuliusBrussee/caveman","slug":"probe-object-still-exists-after-purge","errorCode":null,"errorMessage":"probe object still exists after purge","messagePattern":"probe object still exists after purge","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/objectstore/objectstore.go","lineNumber":266,"sourceCode":"\t\t}\n\t}()\n\tgot, err := store.Get(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !bytes.Equal(got, probe) {\n\t\treturn errors.New(\"probe bytes did not round-trip\")\n\t}\n\tif err := PurgeObject(ctx, store, key); err != nil {\n\t\treturn err\n\t}\n\tcleaned = true\n\texists, err := store.Exists(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn errors.New(\"probe object still exists after purge\")\n\t}\n\treturn nil\n}\n\nfunc (m *minioStore) Put(ctx context.Context, key string, body []byte, contentType string) error {\n\tif contentType == \"\" {\n\t\tcontentType = \"application/octet-stream\"\n\t}\n\t_, err := m.client.PutObject(ctx, m.bucket, key, bytes.NewReader(body), int64(len(body)),\n\t\tminio.PutObjectOptions{ContentType: contentType})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"objectstore: put %q: %w\", key, err)\n\t}\n\treturn nil\n}\n\nfunc (m *minioStore) Get(ctx context.Context, key string) ([]byte, error) {\n\tobj, err := m.client.GetObject(ctx, m.bucket, key, minio.GetObjectOptions{})","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/objectstore/objectstore.go#L248-L284","documentation":"This error is thrown by the object store Probe health-check after it deletes its temporary probe object: it wrote a key, read it back, deleted it, and store.Exists still reports the key present. It proves the purge (delete) path of the store silently failed, so the store cannot be trusted for cleanup-sensitive work.","triggerScenarios":"Calling Probe() (directly or via FromEnv) against a store whose Delete succeeded but did not actually remove the object — e.g. a MinIO/S3-compatible backend with versioning enabled where delete only adds a delete marker, or a store implementation whose Exists treats delete markers as existing objects.","commonSituations":"Live contract tests (TestLiveMinioContract) and deadline tests (TestProbeCleanupHonorsCallerDeadline) against MinIO buckets with bucket versioning or lifecycle/replication rules that resurrect objects; misconfigured test fixtures pointing at a read-only or proxied bucket.","solutions":["Disable bucket versioning (or suspend it / purge delete markers) on the probe bucket","Verify the minioStore Delete path actually removes the object rather than only issuing a remove request that errors silently","Check for middleware/proxies between the store and MinIO that cache HEAD/StatObject results after delete","Re-run Probe with a fresh unique key to rule out collisions with a leftover object from a previous run"],"exampleFix":"// before: probe fails because bucket versioning keeps the object visible\nmc version enable local/probe-bucket\n// after\nmc version suspend local/probe-bucket\n// or in code, delete all versions before asserting:\n// store.Delete(ctx, key); store.Delete(ctx, key) // second call clears delete marker","handlingStrategy":"validation","validationCode":"if err := store.Delete(ctx, key); err != nil { return err }\nif exists, _ := store.Exists(ctx, key); exists { return fmt.Errorf(\"stale probe key %q survived delete\", key) }","typeGuard":"func purgeSucceeded(ctx context.Context, s interface{ Delete(context.Context,string) error; Exists(context.Context,string) (bool,error) }, key string) bool {\n    if err := s.Delete(ctx, key); err != nil { return false }\n    exists, err := s.Exists(ctx, key)\n    return err == nil && !exists\n}","tryCatchPattern":"if err := probe.Run(ctx); err != nil {\n    if strings.Contains(err.Error(), \"probe object still exists after purge\") {\n        log.Error(\"object store delete path broken; check bucket versioning\")\n        return ErrStoreCleanupBroken\n    }\n    return err\n}","preventionTips":["Keep bucket versioning off (or handle delete markers) on buckets used for probe/health checks","Use a fresh unique key per probe run to avoid collisions with stale objects","Assert deletion in your own store-contract tests, not only via Probe","Watch for proxies/caches between the app and the object store that can serve stale Exists results"],"tags":["object-storage","cleanup","minio","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}