Skip to content

Fix: empty --namespace coerced to __default__ on all vector/record commands#88

Merged
austin-denoble merged 1 commit into
mainfrom
adenoble/fix-default-namespace-coercion
May 5, 2026
Merged

Fix: empty --namespace coerced to __default__ on all vector/record commands#88
austin-denoble merged 1 commit into
mainfrom
adenoble/fix-default-namespace-coercion

Conversation

@austin-denoble
Copy link
Copy Markdown
Collaborator

@austin-denoble austin-denoble commented May 4, 2026

Problem

Fixes #85.

When a user passes --namespace "" to any index vector or record command, the CLI ignores it and silently queries the __default__ namespace instead, returning no results even though vectors exist in the default namespace.

The root cause is in the Go SDK: pc.Index() coerces Namespace: "" to "__default__" unconditionally (go-pinecone client.go:286). This means the literal string "__default__" is sent on the wire over gRPC.

Sending "__default__" requires an active server-side conversion to map it back to "" (the canonical internal representation of the default namespace). That conversion only runs at API version ≥ 2025-04; at older API versions the server actively blocks it with a validation error. By contrast, sending "" directly passes through unchanged on every server version — it is the proto3 zero value for a string field (omitted on the wire) and the server always treats an absent namespace as the default.

Additionally, the Go SDK's assumption was incorrect: "__default__" was introduced as a human-readable alias that clients can send, not the canonical wire format. Clients should send "" and let the server surface "__default__" in responses (which it does at ≥ 2025-04).

Solution

Two changes:

  1. sdk.NewIndexConnection: after pc.Index() creates the connection (where the """__default__" coercion happens), immediately re-apply the caller's original namespace via ic.WithNamespace(namespace). WithNamespace sets the field directly, bypassing the coercion. Empty namespace now reaches the gRPC wire as "" (proto3 zero value / omitted field), which the server correctly interprets as the default namespace on all versions.

  2. --namespace flag defaults: changed from "__default__" to "" across all eight affected commands (index vector query/upsert/update/fetch/delete/list and index record upsert/search). This makes the CLI default consistent with how the server represents the default namespace (e.g. as shown by pc index stats).

Note: the underlying Go SDK also needs a fix — the coercion at pc.Index() should be removed. The CLI workaround via WithNamespace is sufficient for now but the SDK fix should be tracked separately.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Test Plan

  • just test-unit passes with no failures.
  • To validate end-to-end: run pc index stats --index-name <index> on an index with vectors in the default namespace (shows "" key), then confirm pc index vector query --index-name <index> --vector '[...]' --top-k 5 --json returns matches (previously required explicit --namespace __default__ which itself was broken for some users).

…perspective, this avoids an underlying issue in the current Go SDK
@austin-denoble austin-denoble changed the title Remove default ("__default__") namespace conversion Fix: empty --namespace coerced to __default__ on all vector/record commands May 4, 2026
@austin-denoble austin-denoble merged commit 8605780 into main May 5, 2026
8 checks passed
@austin-denoble austin-denoble deleted the adenoble/fix-default-namespace-coercion branch May 5, 2026 14:37
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.

pc index vector query: empty --namespace coerced to __default__

1 participant