FlowiseAI/Flowise · error · Error

Argument '${arg}' contains dangerous flag '-${ch}' for comma

Error message

Argument '${arg}' contains dangerous flag '-${ch}' for command '${command}'.

What it means

Thrown by validateCommandFlags during the combined-short-flag check. After the per-flag loop, if an arg matches /^-[a-zA-Z]{2,}/ (a multi-char short flag bundle like '-yc'), the code splits off the '-' and iterates each character; if any char is in dangerousShortChars (the single-letter dangerous flags like 'c' for npx/python, 'e'/'p'/'r' for node, 'v' for docker) it throws naming the offending '-<ch>'.

Source

Thrown at packages/components/nodes/tools/MCP/core.ts:402

            const lowerCaseFlag = flag.toLowerCase()
            if (normalizedArg === lowerCaseFlag) {
                throw new Error(`Argument '${arg}' is not allowed for command '${command}'.`)
            }
            if (normalizedArg.startsWith(lowerCaseFlag + '=')) {
                throw new Error(`Argument '${arg}' contains flag '${flag}' that is not allowed for command '${command}'.`)
            }
            if (flag.startsWith('-') && normalizedArg.startsWith(lowerCaseFlag + ' ')) {
                throw new Error(`Argument '${arg}' contains flag '${flag}' that is not allowed for command '${command}'.`)
            }
        }

        // Check for combined short flags (e.g. "-yc" = "-y" + "-c")
        // A combined flag starts with a single '-', is not a long flag '--', and has multiple characters after '-'
        if (/^-[a-zA-Z]{2,}/.test(normalizedArg)) {
            const flagChars = normalizedArg.slice(1) // strip leading '-'
            for (const ch of flagChars) {
                if (dangerousShortChars.has(ch)) {
                    throw new Error(`Argument '${arg}' contains dangerous flag '-${ch}' for command '${command}'.`)
                }
            }
        }
    }
}

/**
 * Validates a user-supplied MCP server configuration against operator-controlled allow-lists.
 *
 * For stdio configs, the command must appear in the `CUSTOM_MCP_ALLOWED_COMMANDS` allow-list
 * (comma-separated, empty = none allowed). The list is empty by default, so no command can run
 * until an operator explicitly opts in. To enable local/custom stdio MCP servers, set
 * `CUSTOM_MCP_PROTOCOL=stdio` and `CUSTOM_MCP_ALLOWED_COMMANDS` in your env file
 * (see docker/.env.example, docker/worker/.env.example, packages/server/.env.example).
 */
export const validateMCPServerConfig = (serverParams: any): void => {
    // Validate the entire server configuration
    if (!serverParams || typeof serverParams !== 'object') {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Unbundle combined short flags and remove any dangerous ones.
  2. Avoid '-c' entirely for npx/python/python3 and '-e'/'-p'/'-r' for node.
  3. If a combined flag is legitimate but includes a dangerous letter, restructure so the dangerous capability is not invoked.

Example fix

// before
{ command: 'npx', args: ['-yc', 'pkg'] }

// after
{ command: 'npx', args: ['pkg'] } // no auto-confirm+exec bundle
Defensive patterns

Strategy: validation

Validate before calling

const dangerousShort = new Set(['c', 'e', 'p', 'r', 'v']) // single-letter dangerous flags per command
if (args.some(a => /^-[a-zA-Z]{2,}/.test(a) && a.slice(1).split('').some(ch => dangerousShort.has(ch.toLowerCase())))) {
  throw new Error('Arg bundles a dangerous short flag')
}

Type guard

const argsHaveNoDangerousBundledShortFlags = (args: string[], dangerousShort: Set<string>): boolean =>
  !args.some(a => typeof a === 'string' && /^-[a-zA-Z]{2,}/.test(a) && a.slice(1).split('').some(ch => dangerousShort.has(ch.toLowerCase())))

Try / catch

try {
  validateCommandFlags(command, args)
} catch (e) {
  if (e.message.includes('contains dangerous flag')) {
    // unbundle the short flags and drop the dangerous one
  }
  throw e
}

Prevention

When it happens

Trigger: An arg bundles a dangerous short flag with others, e.g. npx '-yc' (auto-confirm + execute), node '-pe' (print + eval), python '-mc'. The earlier exact-match and =/space checks miss this, so the dedicated combined-flag scan catches it.

Common situations: Operator tries to hide '-c' inside '-yc' to bypass the exact-flag guard; legitimate combined flags that happen to include a dangerous letter (e.g. '-vc').

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/7871c438b1e4e4df. Report an issue: GitHub.