Skip to content

fix(wrangler): vectorize list and list-metadata-index should output valid json#12807

Merged
emily-shen merged 7 commits intocloudflare:mainfrom
MaxwellCalkin:fix/vectorize-list-json-output
Mar 11, 2026
Merged

fix(wrangler): vectorize list and list-metadata-index should output valid json#12807
emily-shen merged 7 commits intocloudflare:mainfrom
MaxwellCalkin:fix/vectorize-list-json-output

Conversation

@MaxwellCalkin
Copy link
Copy Markdown
Contributor

@MaxwellCalkin MaxwellCalkin commented Mar 8, 2026

Fixes #11011.

Follows the same pattern as PR #10517 (which fixed list-vectors --json for #10508).

Problem

wrangler vectorize list --json and wrangler vectorize list-metadata-index --json print a human-readable log message before the JSON output:

📋 Listing Vectorize indexes...
[
  { ... }
]

This makes stdout invalid JSON and breaks piping to jq and other tools.

Fix

Wrap the logger.log() calls in if (!args.json) guards so the log message is suppressed when --json is used — the same one-line pattern applied in #10517 for list-vectors.

list.ts:

-		logger.log(`📋 Listing Vectorize indexes...`);
+		if (!args.json) {
+			logger.log(`📋 Listing Vectorize indexes...`);
+		}

listMetadataIndex.ts:

-		logger.log(`📋 Fetching metadata indexes...`);
+		if (!args.json) {
+			logger.log(`📋 Fetching metadata indexes...`);
+		}

  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bugfix
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: v4 only

Open with Devin

@MaxwellCalkin MaxwellCalkin requested a review from a team as a code owner March 8, 2026 11:16
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 8, 2026

🦋 Changeset detected

Latest commit: d1ad964

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 8, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen emily-shen self-assigned this Mar 10, 2026
@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Mar 10, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 10, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12807

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12807

miniflare

npm i https://pkg.pr.new/miniflare@12807

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12807

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12807

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12807

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12807

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12807

wrangler

npm i https://pkg.pr.new/wrangler@12807

commit: 81f1dfe

Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Looks good to me, besides the changeset which I think that ideally should be updated

Comment thread packages/wrangler/src/vectorize/create.ts
Comment thread .changeset/quiet-foxes-grow.md
Comment thread .changeset/quiet-foxes-grow.md
Comment thread .changeset/quiet-foxes-grow.md Outdated
MaxwellCalkin and others added 6 commits March 10, 2026 14:30
…alid json

Wrap the log messages in `if (!args.json)` guards so that
`wrangler vectorize list --json` and
`wrangler vectorize list-metadata-index --json` output only valid JSON
without a preceding human-readable log line.

Follows the same pattern used in PR cloudflare#10517 for list-vectors.
@emily-shen emily-shen force-pushed the fix/vectorize-list-json-output branch from fb694b9 to 16c6890 Compare March 10, 2026 14:30
@emily-shen emily-shen added the skip-pr-description-validation Skip validation of the required PR description format label Mar 10, 2026
@emily-shen emily-shen merged commit 8d1e130 into cloudflare:main Mar 11, 2026
36 of 38 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-description-validation Skip validation of the required PR description format

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

wrangler vectorize list --json and list-metadata-index --json output a log/message (not valid json)

4 participants