Skip to content

[bug] CLI crashes at load: await in non-async SIGINT handler (src/cli/index.js:1646) #35

Closed

Description

@SarthakB11

Environment

  • xactions 3.1.0 (current npm latest, installed from git main)
  • Node v20.18.1, Linux (WSL2 Ubuntu)

What happened

Every xactions CLI invocation crashes at module-load with a SyntaxError, so no command runs, not even xactions --help:

file:///.../node_modules/xactions/src/cli/index.js:1646
        const { stopMonitor: stop } = await import('../analytics/reputation.js');
                                      ^^^^^
SyntaxError: Unexpected reserved word
    at compileSourceTextModule (node:internal/modules/esm/utils:339:16)

Cause

At src/cli/index.js:1646 an await import() is used inside a non-async process.on('SIGINT', () => { ... }) callback:

process.on('SIGINT', () => {
  const { stopMonitor: stop } = await import('../analytics/reputation.js');
  ...
});

The enclosing .action(async (target, options) => {...}) is async, but the SIGINT arrow function is not. await in a non-async function is a parse-time error, and because ESM parses the whole module before executing, it takes down the entire CLI binary rather than just the monitor command.

Fix

Make the handler async (process.on('SIGINT', async () => {), or hoist the import above the handler. The MCP server entry (src/mcp/server.js) is unaffected and still starts.

Activity

  1. nirholas commented on Sep 12, 2026

    @nirholas
    Owner

    looking into this

  2. nirholas commented on Sep 14, 2026

    @nirholas
    Owner

    Thanks for the exact parse-time diagnosis. Current main has an async SIGINT callback at this location, node --check passes, and the CLI loads successfully. Closing as resolved; credit to @SarthakB11 for identifying the fault clearly.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions