#17620·vercel

vercel dev fails Python functions with "must not contain `maxDuration`" whenever functions.maxDuration/memory is configured

Author: RJPercivalCreated Sep 17, 2026Updated Sep 17, 2026

Description

vercel dev fails every request to a Python function whenever vercel.json's functions entry for that function sets maxDuration (and/or memory), with:

Error: The result of "builder.build()" must not contain `maxDuration`

Root cause

Since @vercel/[email protected] (#16807), the Python builder applies any matching functions config directly onto the build output (getPythonLambdaOptions in packages/python/src/index.ts) — unconditionally, including when meta.isDev is true.

However, vercel dev's CLI-side builder normalizer (packages/cli/src/util/dev/builder.ts) independently enforces the opposite invariant for v3 builders — it throws if the builder's build() result already contains maxDuration/memory, because it expects to apply config.functions itself, after the build:

typescript
if (output.maxDuration) {
  throw new Error(
    'The result of "builder.build()" must not contain `maxDuration`'
  );
}

These two behaviors directly conflict, so any Python function with a functions.maxDuration (or memory) override in vercel.json breaks vercel dev entirely. This is dev-only — vercel build/deploy has no matching check, so production builds are unaffected. Still reproducible on main as of 2026-09-17.

To reproduce

vercel.json:

json
{
  "functions": {
    "api/index.py": {
      "maxDuration": 30
    }
  }
}

api/index.py:

python
def handler(request):
    return {"statusCode": 200, "body": "ok"}

Run vercel dev, then request /api/index. Every request fails with the error above.

Expected behaviour

vercel dev should either apply functions config the same way the Python builder now does (skip the CLI-side re-application for builders that already applied it), or the Python builder should skip applying functions config when meta.isDev is true and leave it to the CLI, matching how it presumably worked before #16807.

Environment

  • vercel CLI: 59.20.0 (also reproduced across all versions from 54.17.3 through 59.20.0)
  • @vercel/python: 6.58.0 (bundled)
  • Node.js: 22.14.0
  • OS: macOS