Claude Opus 5.5

wrangler-4-111-0-0-b

Claude Code's read-only tools, web search on, ludion sync off

Question

My wrangler config sets legacy_env = true and deploys now fail. What happened, and what should the config look like?

Answer key

A correct answer says
Wrangler no longer supports service environments: the `legacy_env` field and `--legacy-env` flag are gone (the field now raises an error) and every environment deploys as its own Worker named <name>-<environment>.
The stale answer
You can set `legacy_env = false` in wrangler.toml to use service environments, where all environments belong to one Worker.

Answer

Your installed Wrangler (4.148.0) has dropped the `legacy_env` field. Any config that contains it now fails validation with an error. I found the check in `node_modules/wrangler/wrangler-dist/cli.js:20314`, and its error message says "The 'legacy_env' field is no longer supported, so please remove it." Service environments have been removed, so each environment always deploys as its own Worker named `<name>-<environment>`. That is exactly what `legacy_env = true` did, and it was already the default.

The fix is to delete the `legacy_env` line. How your Workers deploy won't change. The `wrangler.jsonc` in this directory doesn't contain `legacy_env`, so I couldn't see your exact file, but the cleaned-up config should look like this, with any `env` blocks kept as they are:

```jsonc
{
  "name": "bench-worker",
  "main": "src/index.js",
  "compatibility_date": "2026-10-01"
  // "env": { "staging": { ... } }  → deploys as "bench-worker-staging"
}
```

Answering cost $0.12.

Grade

correct

The judge's reason: It says the legacy_env field was removed and now errors, that service environments are gone, and that each environment deploys as <name>-<environment>, with no stale claim.

The judge's log

Session log

What the agent wrote, the tools it called, and what they returned, from docs/bench/2026-10-11-done3/runs/B-project/wrangler-4-111-0-0-b.jsonl. Thinking and the session's settings are left out. The raw log

  1. Tool call: Bash

    {
      "command": "cd \"C:/Users/haya0/AppData/Local/Temp/ludion-bench-zLAJfg/work\" && ls -la && cat wrangler.* package.json 2>/dev/null | head -80",
      "description": "List project files and show wrangler config"
    }
  2. Tool output

    total 66
    drwxr-xr-x 1 haya0 197609     0 Oct 11 19:42 .
    drwxr-xr-x 1 haya0 197609     0 Oct 11 19:42 ..
    drwxr-xr-x 1 haya0 197609     0 Oct 11 19:42 node_modules
    -rw-r--r-- 1 haya0 197609 50058 Oct 11 09:33 package-lock.json
    -rw-r--r-- 1 haya0 197609   187 Oct 11 09:32 package.json
    drwxr-xr-x 1 haya0 197609     0 Oct 11 19:42 src
    -rw-r--r-- 1 haya0 197609    93 Oct 11 09:32 wrangler.jsonc
    {
      "name": "bench-worker",
      "main": "src/index.js",
      "compatibility_date": "2026-10-01"
    }
    {
      "name": "bench-wrangler",
      "private": true,
      "type": "module",
      "scripts": { "dev": "wrangler dev", "deploy": "wrangler deploy" },
      "devDependencies": { "wrangler": "4.148.0" }
    }
  3. Tool call: Bash

    {
      "command": "cd \"C:/Users/haya0/AppData/Local/Temp/ludion-bench-zLAJfg/work\" && grep -o '\"version\": *\"[^\"]*\"' node_modules/wrangler/package.json; grep -rhoE '.{200}legacy_env.{300}' node_modules/wrangler/wrangler-dist/cli.js | head -8",
      "description": "Check wrangler version and legacy_env handling"
    }
  4. Tool output

    "version": "4.148.0"
  5. Tool call: Bash

    {
      "command": "cd \"C:/Users/haya0/AppData/Local/Temp/ludion-bench-zLAJfg/work\" && grep -rlE 'legacy_env|legacyEnv' node_modules/wrangler --include=*.js --include=*.md --include=*.json 2>/dev/null | head; grep -rhoE '.{250}(legacy_env|legacyEnv).{350}' node_modules/wrangler --include=*.js 2>/dev/null | head -6",
      "description": "Search wrangler package for legacy_env references"
    }
  6. Tool output

    node_modules/wrangler/wrangler-dist/cli.js
  7. Tool call: Bash

    {
      "command": "cd \"C:/Users/haya0/AppData/Local/Temp/ludion-bench-zLAJfg/work\" && grep -nE 'legacy_env|legacyEnv' node_modules/wrangler/wrangler-dist/cli.js | cut -c1-600 | head -20",
      "description": "Show legacy_env lines in wrangler CLI"
    }
  8. Tool output

    20314:  if ("legacy_env" in rawConfig) {
    20318:					The "legacy_env" field is no longer supported, so please remove it from your configuration file.
    20319:					Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
    20324:    delete rawConfig.legacy_env;
  9. Tool call: Bash

    {
      "command": "cd \"C:/Users/haya0/AppData/Local/Temp/ludion-bench-zLAJfg/work\" && sed -n 20305,20330p node_modules/wrangler/wrangler-dist/cli.js",
      "description": "Show surrounding code for legacy_env check"
    }
  10. Tool output

    function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
      const diagnostics = new Diagnostics(
        `Processing ${configPath ? path28__namespace.default.relative(process.cwd(), configPath) : "wrangler"} configuration:`
      );
      const isRedirectedConfig2 = isRedirectedRawConfig(
        rawConfig,
        configPath,
        userConfigPath
      );
      if ("legacy_env" in rawConfig) {
        if (!isRedirectedConfig2) {
          diagnostics.errors.push(
            dedent`
    					The "legacy_env" field is no longer supported, so please remove it from your configuration file.
    					Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
    					Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
    				`
          );
        }
        delete rawConfig.legacy_env;
      }
      validateOptionalProperty(
        diagnostics,
        "",
        "send_metrics",
        rawConfig.send_metrics,
  11. Agent

    Your installed Wrangler (4.148.0) has dropped the `legacy_env` field. Any config that contains it now fails validation with an error. I found the check in `node_modules/wrangler/wrangler-dist/cli.js:20314`, and its error message says "The 'legacy_env' field is no longer supported, so please remove it." Service environments have been removed, so each environment always deploys as its own Worker named `<name>-<environment>`. That is exactly what `legacy_env = true` did, and it was already the default.
    
    The fix is to delete the `legacy_env` line. How your Workers deploy won't change. The `wrangler.jsonc` in this directory doesn't contain `legacy_env`, so I couldn't see your exact file, but the cleaned-up config should look like this, with any `env` blocks kept as they are:
    
    ```jsonc
    {
      "name": "bench-worker",
      "main": "src/index.js",
      "compatibility_date": "2026-10-01"
      // "env": { "staging": { ... } }  → deploys as "bench-worker-staging"
    }
    ```