Skip to content

fix: return NotFound from DeleteCollection for a missing collection - #181

Merged
anush008 merged 1 commit into
qdrant:masterfrom
kailash360:fix/delete-collection-not-found
Nov 2, 2026
Merged

anush008 merged 1 commit into
qdrant:masterfrom
kailash360:fix/delete-collection-not-found

Conversation

@kailash360

Copy link
Copy Markdown
Contributor

Summary

When the collection does not exist, the server answers DeleteCollection with result: false and no gRPC error. The client turned that into a plain errors.New("failed to delete collection"), which has no gRPC status, so status.Code(err) returned codes.Unknown. Every other method I tried reports a missing collection as codes.NotFound (GetCollectionInfo, ListSnapshots, Count), so callers could not tell "the collection is already gone" apart from a real failure without matching the error text.

DeleteCollection now returns a NotFound status error in this case. QdrantError already unwraps to its inner error, so status.Code(err) and status.FromError(err) return NotFound:

if err := client.DeleteCollection(ctx, name); err != nil && status.Code(err) != codes.NotFound {
	return err
}

The error message changes from:

DeleteCollection() failed: missing: failed to delete collection

to:

DeleteCollection() failed: missing: rpc error: code = NotFound desc = collection "missing" does not exist

Behavior change: callers that only check err != nil are unaffected. Code that matched the old text "failed to delete collection" needs to check status.Code(err) == codes.NotFound instead.

Fixes #

Changes

  • qdrant/collections.go: return status.Errorf(codes.NotFound, ...) wrapped in QdrantError when the server reports result: false
  • qdrant_test/collections_test.go: DeleteNonExistentCollection now also checks status.Code(err) == codes.NotFound

Checks

  • go test ./... passes, including the integration tests
  • The updated DeleteNonExistentCollection check fails on master (Unknown instead of NotFound) and passes with this change
  • golangci-lint run reports 0 issues
  • gofmt -s -l qdrant qdrant_test reports nothing

Closes #180

@kailash360 kailash360 changed the title fix: return NotFound from DeleteCollection for a missing collection fix: return NotFound from DeleteCollection for a missing collection Nov 1, 2026

@anush008 anush008 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@anush008
anush008 merged commit 3fda174 into qdrant:master Nov 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeleteCollection returns an error with no gRPC status code for a missing collection, unlike every other method

2 participants