nodejs/node · error · MBErr
Failed to parse config file "%s": %s
Error message
Failed to parse config file "%s": %s
What it means
ReadConfigFile() parses mb_config.pyl with ast.literal_eval. If the file is not a valid Python literal (syntax error), the SyntaxError is caught and re-raised as MBErr('Failed to parse config file "%s": %s') chaining the original via `from e`. The message includes the file path and the underlying parse error detail.
Source
Thrown at deps/v8/tools/mb/mb.py:565
self.args.builder_group, self.args.builder + '.json')
if not self.Exists(path):
return {}
contents = json.loads(self.ReadFile(path))
gn_args = ' '.join(contents.get('gn_args', []))
vals = self.DefaultVals()
vals['gn_args'] = gn_args
return vals
def ReadConfigFile(self):
if not self.Exists(self.args.config_file):
raise MBErr('config file not found at %s' % self.args.config_file)
try:
contents = ast.literal_eval(self.ReadFile(self.args.config_file))
except SyntaxError as e:
raise MBErr('Failed to parse config file "%s": %s' %
(self.args.config_file, e)) from e
self.configs = contents['configs']
self.luci_tryservers = contents.get('luci_tryservers', {})
self.builder_groups = contents['builder_groups']
self.mixins = contents['mixins']
def ReadIsolateMap(self):
if not self.args.isolate_map_files:
self.args.isolate_map_files = [self.default_isolate_map]
for f in self.args.isolate_map_files:
if not self.Exists(f):
raise MBErr('isolate map file not found at %s' % f)
isolate_maps = {}
for isolate_map in self.args.isolate_map_files:
try:
isolate_map = ast.literal_eval(self.ReadFile(isolate_map))View on GitHub (pinned to 1b2de5e052)
Solutions
- Open mb_config.pyl and run `python3 -c "import ast; ast.literal_eval(open('infra/mb/mb_config.pyl').read())"` to get the exact line/column of the syntax error, then fix it.
- Re-resolve any merge-conflict markers (<<<<<<, =======, >>>>>>) left in the file.
- Validate with `mb.py validate -f <file>` after the fix.
Example fix
// before
'configs': {
'x64.release': {'mixins': ['x64', 'release']} // missing trailing comma before next entry
}
// after
'configs': {
'x64.release': {'mixins': ['x64', 'release']},
} Defensive patterns
Strategy: validation
Validate before calling
import ast
try:
ast.literal_eval(open(mb_config_path).read())
except SyntaxError as e:
sys.exit(f'mb_config.pyl parse error at line {e.lineno}: {e.msg}') Type guard
null
Try / catch
try:
ast.literal_eval(text)
except SyntaxError as e:
raise MBErr(f'Failed to parse config file "{path}": {e}') from e Prevention
- After editing mb_config.pyl, run `python3 -c "import ast; ast.literal_eval(open('infra/mb/mb_config.pyl').read())"` to catch syntax errors.
- Always fully resolve merge-conflict markers in config files.
- Use `mb.py validate` as a pre-commit hook for mb_config.pyl.
When it happens
Trigger: mb_config.pyl contains a Python syntax error: unbalanced brackets, a stray comma, an invalid token, a dangling quote, or trailing junk. ast.literal_eval raises SyntaxError, caught and converted to MBErr.
Common situations: Hand-editing mb_config.pyl and leaving a syntax error; a botched merge conflict resolution; copy-paste that broke quoting; a tab/space inconsistency in a Python literal.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse isolate map file "%s": %s
- mb config file %s has problems:
- args file "%s" not found
- Config "%s" not found in %s
- config file not found at %s
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/5a09f7e5ae18a4a1.
Report an issue: GitHub.