nodejs/node · error · Exception

Malformed line: ' '.

Error message

Malformed line: '%s'.

What it means

The test runner parses status files (the .status files that express expected results/conditions per test path). Each meaningful line must match either a definition pattern (key = condition) or a path-prefix pattern; any line matching neither is rejected as malformed.

Solutions

  1. Open the file named in the error and fix the offending line to match the status-file grammar (key = condition, or a valid path prefix).
  2. Remove any `<<<<<<<`/`=======`/`>>>>>>>` merge-conflict markers.
  3. Re-save the file as UTF-8 without BOM and LF line endings.

Example fix

// before (in test/parallel/.status)
  parallel/test-foo PASS,FLAKY       # malformed: missing '=' grammar
// after
  parallel/test-foo: PASS,FLAKY      # use the documented prefix/condition form
Defensive patterns

Strategy: validation

Validate before calling

# cheap pre-check: every non-comment, non-blank line matches DEF or PREFIX
import re
ok = re.compile(r'^\s*(#.*)?$')
assert all(ok.match(l) or DEF_PATTERN.match(l) or PREFIX_PATTERN.match(l)
           for l in open(status_file)), f'{status_file} has a malformed line'

Prevention

When it happens

Trigger: A syntax error in a .status file: a stray token, a malformed condition, a missing '=', or a prefix line in the wrong shape.

Common situations: Hand-editing a .status file; unresolved git merge-conflict markers left in it; a BOM or CRLF/CRLF-only encoding issue; copy-paste introducing invisible characters.

Understand the failure class

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/34190380e42308a6. Report an issue: GitHub.

Appendix: source

Thrown at tools/test.py:1376

      value_str = rule_match.group(2).strip()
      value = ParseCondition(value_str)
      if not value:
        return False
      current_section.AddRule(Rule(rule_match.group(1), path, value))
      continue
    def_match = DEF_PATTERN.match(line)
    if def_match:
      name = def_match.group(1).lower()
      value = ParseCondition(def_match.group(2).strip())
      if not value:
        return False
      defs[name] = value
      continue
    prefix_match = PREFIX_PATTERN.match(line)
    if prefix_match:
      prefix = SplitPath(prefix_match.group(1).strip())
      continue
    raise Exception("Malformed line: '%s'." % line)


# ---------------
# --- M a i n ---
# ---------------


ARCH_GUESS = utils.GuessArchitecture()


def BuildOptions():
  result = argparse.ArgumentParser()
  result.add_argument("-m", "--mode", help="The test modes in which to run (comma-separated)",
      default='release')
  result.add_argument("-v", "--verbose", help="Verbose output",
      default=False, action="store_true")
  result.add_argument('--logfile', dest='logfile',
      help='write test output to file. NOTE: this only applies the tap progress indicator')

View on GitHub (pinned to 1b2de5e052)