mastra-ai/mastra · warning

Cancelled

Error message

Cancelled

What it means

When provisioning observability in interactive mode, the CLI shows a project picker via @clack/prompts. This error is thrown when the user cancels the picker (Esc/Ctrl-C), aborting provisioning.

Source

Thrown at packages/cli/src/commands/init/observability-provision.ts:106

    if (!defaultProjectName) {
      throw new Error('defaultProjectName is required when mode is "create"');
    }
    project = await createProjectByName({ token, orgId, name: defaultProjectName });
  } else {
    const projects = await listProjects(token, orgId);
    if (projects.length === 0) {
      project = await createProject({ token, orgId, defaultName: defaultProjectName, orgName });
    } else {
      const choice = await p.select({
        message: `Select a project (in ${orgName})`,
        options: [
          ...projects.map(proj => ({ value: proj.id, label: proj.name, hint: proj.slug })),
          { value: '__new__', label: '+ Create new project' },
        ],
      });

      if (p.isCancel(choice)) {
        throw new Error('Cancelled');
      }

      if (choice === '__new__') {
        project = await createProject({ token, orgId, defaultName: defaultProjectName, orgName });
      } else {
        project = projects.find(proj => proj.id === choice)!;
      }
    }
  }

  const secret = await mintOrgToken({
    token,
    orgId,
    keyName: `mastra observability – ${project.name}`,
  });

  const result: ObservabilityProvisionResult = {
    token: secret,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Select an existing project or '+ Create new project' instead of cancelling.
  2. Run in a non-interactive mode by supplying the project name/flags so no prompt is shown.
  3. If running in CI, ensure a TTY or use flag-based provisioning to avoid the interactive picker.
  4. Catch the 'Cancelled' error in wrappers around init and exit gracefully with code 0.
Defensive patterns

Strategy: try-catch

Validate before calling

const isInteractive = process.stdout.isTTY;
if (!isInteractive) {
  // use flag-based provisioning to skip the picker
}

Try / catch

try {
  await provisionObservabilityProject(options);
} catch (err) {
  if (err.message === 'Cancelled') {
    process.exit(0); // user aborted; exit gracefully
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `mastra init` observability provisioning, and pressing Esc or Ctrl-C at the 'select a project' prompt when projects already exist in the organization.

Common situations: Developers abandoning init midway, CI environments where no TTY is available so the prompt is auto-cancelled, or users without permissions choosing to abort.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/b24069729e3ef2c5. Report an issue: GitHub.