Skip to content

Tasks can't run on the CLI in dev mode #4187

Closed

Description

@jkniest

Environment

Nitro: Current main branch

Nitro Config:

import { defineConfig } from 'nitro';

export default defineConfig({
  serverDir: './server',

  experimental: {
    tasks: true,
  },
});

Node: Newest LTS, but is unrelated for the bug

Reproduction

https://stackblitz.com/edit/github-wtbduyfz?file=server%2Ftasks%2Fexample.ts

After dev server started, open a second terminal and run:

npx nitro task run example

Describe the bug

In the current beta version and main branch it is not possible to run tasks via the CLI, e.g.: npx nitro task run example (doesn't matter which package manager you use).

The CLI runs the command using POST, while on the Dev Server only GET is registered, so it doesn't work.

Issue:
CleanShot 2026-04-07 at 14 12 35@2x

Reproduction is available here: https://stackblitz.com/edit/github-wtbduyfz?file=README.md

When the dev server runs, open a second terminal as seen in the screenshot and try to run the example command.

Additional context

No response

Logs

❯ npx nitro task run example
[2:12:34 PM] ℹ Using index.html as renderer template.
[2:12:34 PM] ℹ Running task example...

[2:12:34 PM]  ERROR  Failed to run task example: Error: Not Found

Activity

  1. added
    pending triage
    on Apr 7, 2026
  2. parallax1s commented on Apr 8, 2026

    @parallax1s

    I’d like to work on this.

    I reproduced from the StackBlitz repro: npx nitro task run example fails in dev mode with Not Found.
    From initial inspection, CLI task execution uses POST while the dev task route appears to expose GET.

    Proposed fix direction:

    • align dev endpoint and CLI method semantics for task execution
    • add a regression test to cover nitro task run <name> against dev server

    Can a maintainer confirm this is the preferred direction before I open a draft PR?

  3. jkniest commented on Apr 8, 2026

    @jkniest
    ContributorAuthor

    From initial inspection, CLI task execution uses POST while the dev task route appears to expose GET.

    Yeah, thats what I wrote above 😅 I already have an PR open fyi #4188 – maybe you can have a look and see if it fits your idea?

    Thanks!

  4. added
    bug
    and removed
    pending triage
    on Apr 10, 2026
  5. added theissue type on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions