Skip to content

fix(wrangler): explain how to resolve a user/deploy configuration conflict - #15534

Open
vahidshaik1901 wants to merge 1 commit into
cloudflare:mainfrom
vahidshaik1901:fix/config-conflict-error-guidance
Open

fix(wrangler): explain how to resolve a user/deploy configuration conflict#15534
vahidshaik1901 wants to merge 1 commit into
cloudflare:mainfrom
vahidshaik1901:fix/config-conflict-error-guidance

Conversation

@vahidshaik1901

@vahidshaik1901 vahidshaik1901 commented Sep 6, 2026

Copy link
Copy Markdown

Fixes #8722.

When a user configuration file and a .wrangler/deploy/config.json are found under different base paths, the error reported the conflict and stopped there:

✘ [ERROR] Found both a user configuration file at "wrangler.jsonc"

  and a deploy configuration file at "../.wrangler/deploy/config.json".
  But these do not share the same base path so it is not clear which should be used.

Both paths are discovered by searching up the directory tree independently, so they can settle in different directories. Nothing in the message said which location Wrangler actually wanted, or what to do about it — the reader is left guessing whether to move a file, delete one, or run the command somewhere else.

Changes

The message now:

  • names the path the deploy configuration would have to sit at to be applied, which is the value the conflict check already computes
  • suggests deleting it when it is left over from a previous build, or running the command from the directory that owns the intended configuration
  • links to Generated Wrangler configuration

The expected path was already being computed inline by the conflict condition, so it is lifted into a variable and reused rather than recomputed.

New output for the first existing test case:

Found both a user configuration file at "foo/wrangler.toml"
and a deploy configuration file at "foo/bar/.wrangler/deploy/config.json".
But these do not share the same base path so it is not clear which should be used.

A deploy configuration file is generated by a build tool to redirect Wrangler to the configuration it generated.
It is only applied when it sits alongside the user configuration file, which here would be "foo/.wrangler/deploy/config.json".

Please either delete "foo/bar/.wrangler/deploy/config.json" if it is left over from a previous build,
or run this command from the directory containing the configuration you want to use.
See https://developers.cloudflare.com/workers/wrangler/configuration/#generated-wrangler-configuration

Testing

This error already had coverage in findWranglerConfig.test.ts; both existing inline snapshots are updated, and they exercise the two ways the paths can diverge — deploy config deeper than the user config, and shallower than it. All 975 tests across the 29 test files in packages/workers-utils pass. check:type, oxfmt and oxlint --deny-warnings are clean.


  • Tests
    • Tests included/updated
  • Public documentation
    • Documentation not necessary because: this only changes an error message, and it links to existing documentation rather than introducing new behaviour.

Devin Review

…flict

When `findRedirectedWranglerConfig()` found a user configuration file and a
`.wrangler/deploy/config.json` under different base paths, it reported the
conflict and stopped there:

    Found both a user configuration file at "wrangler.jsonc"
    and a deploy configuration file at "../.wrangler/deploy/config.json".
    But these do not share the same base path so it is not clear which should be used.

Both paths are discovered by searching up the directory tree independently, so
they can settle in different directories, and nothing in the message said which
one Wrangler wanted or what to do about it. The reader is left guessing whether
to move a file, delete one, or run the command from somewhere else.

The message now names the path the deploy configuration would have to sit at to
be applied, suggests deleting it when it is left over from a previous build or
running the command from the directory that owns the intended configuration, and
links to the Generated Wrangler configuration documentation.

The expected path was already computed by the conflict check itself, so it is
lifted into a variable and reused rather than recomputed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018W34ieE3NNGaRQBxj5CKkH
@changeset-bot

changeset-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5004915

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

This PR includes changesets to release 9 packages
Name Type
@cloudflare/workers-utils Patch
wrangler Patch
@cloudflare/autoconfig Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/remote-bindings Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
@cloudflare/workers-auth Patch

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

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/config-conflict-error-guidance.md: [@cloudflare/wrangler]
  • packages/workers-utils/src/config/config-helpers.ts: [@cloudflare/wrangler]
  • packages/workers-utils/tests/config/findWranglerConfig.test.ts: [@cloudflare/wrangler]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines +160 to +161
Please either delete "${path.relative(".", deployConfigPath)}" if it is left over from a previous build,
or run this command from the directory containing the configuration you want to use.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Deeper configurations remain unusable

When the wanted configuration is below the unwanted one, run this command repeats the same conflict. Both find.file searches walk upward, so the deeper directory still discovers the unwanted ancestor.

Prompt for agents
The conflict guidance does not resolve every path ordering. Both the user configuration lookup in findWranglerConfig and the deploy configuration lookup in findRedirectedWranglerConfig search upward. Running from a deeper desired configuration's directory therefore continues to find the unwanted configuration in an ancestor. Update the guidance to offer a remedy that works when the desired configuration is deeper, such as an applicable explicit configuration option or removing, moving, or regenerating the conflicting ancestor file. Add tests for selecting each file in both existing path-ordering scenarios.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15534

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15534

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15534

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15534

create-cloudflare

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

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15534

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15534

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15534

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15534

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15534

wrangler

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

commit: 5004915

@vahidshaik1901

Copy link
Copy Markdown
Author

The two red checks are unrelated to this PR — evidence below so nobody has to re-derive it.

This PR changes the text of one UserError in
packages/workers-utils/src/config/config-helpers.ts (plus its inline snapshot and a
changeset). No behaviour, no exported API, no dependency.

Tests (macOS, packages-and-tools) — turbo reports exactly one failed task,
miniflare#test:ci, and exactly one failed test out of 1243:

FAIL  test/plugins/browser/process.spec.ts > gracefully closes Chrome over CDP
AssertionError: expected "vi.fn()" to not be called at all, but actually been called 1 times
 ❯ test/plugins/browser/process.spec.ts:40:34
     40|  expect(browserProcess.kill).not.toHaveBeenCalled();

That test asserts Chrome shut down over CDP without the fallback kill() being needed.
Under CI load the graceful close misses its window and the fallback fires — a timing race
in miniflare's browser plugin, nowhere near config-file discovery.

Tests (Windows, fixtures) — one failed task, @fixture/additional-modules#test:ci:

FAIL  test/index.test.ts > find_additional_modules dev > watches additional modules

A file-watching test on Windows, again unrelated to the changed package.

Both look like the ci-flake category. Happy to rebase if you would rather see a clean
run, but there is nothing in this diff that could reach either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

🐛 BUG: Improve logging for how to resolve conflict in configuration files

2 participants