bmad-code-org/BMAD-METHOD · error · Error

--set: empty entry. Expected <module>.<key>=<value>

Error message

--set: empty entry. Expected <module>.<key>=<value>

What it means

Thrown by parseSetEntry when the --set value is not a string or is empty. Every --set entry must match <module>.<key>=<value>; an empty/missing value gives no module, key, or value to parse and is rejected up front rather than producing a confusing downstream failure.

Source

Thrown at tools/installer/set-overrides.js:37

// assigns into plain `{}` maps keyed by user input, so `--set __proto__.x=1`
// would otherwise reach `overrides.__proto__[x] = 1` and pollute every plain
// object. We reject the names at parse time and harden the maps in
// `parseSetEntries` with `Object.create(null)` for defense-in-depth.
const PROTOTYPE_POLLUTING_NAMES = new Set(['__proto__', 'prototype', 'constructor']);

const path = require('node:path');
const fs = require('./fs-native');
const yaml = require('yaml');

/**
 * Parse a single `--set <module>.<key>=<value>` entry.
 * @param {string} entry - raw flag value
 * @returns {{module: string, key: string, value: string}}
 * @throws {Error} on malformed input
 */
function parseSetEntry(entry) {
  if (typeof entry !== 'string' || entry.length === 0) {
    throw new Error('--set: empty entry. Expected <module>.<key>=<value>');
  }
  const eq = entry.indexOf('=');
  if (eq === -1) {
    throw new Error(`--set "${entry}": missing '='. Expected <module>.<key>=<value>`);
  }
  const lhs = entry.slice(0, eq);
  // Note: only the LHS is trimmed. Values may legitimately contain leading
  // or trailing whitespace (paths with spaces, quoted strings); module / key
  // names cannot, so it's safe to be strict on the left.
  const value = entry.slice(eq + 1);
  const dot = lhs.indexOf('.');
  if (dot === -1) {
    throw new Error(`--set "${entry}": missing '.'. Expected <module>.<key>=<value>`);
  }
  const moduleCode = lhs.slice(0, dot).trim();
  const key = lhs.slice(dot + 1).trim();
  if (!moduleCode || !key) {
    throw new Error(`--set "${entry}": empty module or key. Expected <module>.<key>=<value>`);

View on GitHub (pinned to b70486b9bd)

Solutions

  1. Ensure every --set argument is non-empty and matches <module>.<key>=<value>.
  2. When building --set args from variables, skip entries where the variable is unset or empty.
  3. Quote arguments so the shell preserves them, and echo the assembled command if debugging a wrapper script.

Example fix

# before
#   --set "$MY_VAR"        # MY_VAR unset -> empty entry
#
# after
#   --set "bmm.project_knowledge=research"
Defensive patterns

Strategy: validation

Validate before calling

function isNonEmptySetEntry(entry) {
  return typeof entry === 'string' && entry.length > 0 && entry.includes('=') && entry.includes('.');
}
const entries = rawEntries.filter(isNonEmptySetEntry);
const overrides = parseSetEntries(entries);

Type guard

function isValidSetEntry(entry) {
  return typeof entry === 'string' && /^\S+\.\S+=/.test(entry);
}

Try / catch

try {
  overrides = parseSetEntries(entries);
} catch (e) {
  if (/--set: empty entry/.test(e.message)) {
    // drop empty entries and retry, or warn the user
    entries = entries.filter((e) => typeof e === 'string' && e.length > 0);
    overrides = parseSetEntries(entries);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Passing --set '' to the CLI; calling parseSetEntry('') programmatically; a shell variable expanding to empty (--set "$UNSET_VAR").

Common situations: Empty shell variable expansion; a generated script emits --set args from a map and yields '' for a missing key; quoting accident that strips the value.

Related errors


AI-assisted analysis of bmad-code-org/BMAD-METHOD@b70486b9bd (2026-08-13). Data as JSON: /api/errors/d2834197f0991cbd. Report an issue: GitHub.