NationalSecurityAgency/ghidra · error · Exception
Could not parse pyproject.toml
Error message
Could not parse pyproject.toml
What it means
Raised as a generic Exception by get_module_dependencies() when its hand-rolled line-by-line parser cannot find a 'dependencies = [' ... ']' block in the module's pyproject.toml. The parser expects the literal line 'dependencies = [' followed by quoted entries and a closing ']'; any deviation (different formatting, TOML table structure, missing block) causes a fall-through to this error.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/setuputils.py:65
def get_module_dependencies(name: str) -> List[str]:
src = ghidra_module_src(name)
# Can't rely on tomllib until Python 3.11 is minimum requirement.
# And, I'm in a place where I presume deps are missing, so do this garbage
# of a parse job.
with open(f"{src}/pyproject.toml") as project:
seen_deps = False
result: List[str] = []
for l in project.readlines():
l = l.strip()
if l == "dependencies = [":
seen_deps = True
elif seen_deps and l == ']':
return [r for r in result if not 'ghidra' in r]
elif seen_deps:
if l.endswith(','): # Last one may not have ,
l = l[:-1].strip()
result.append(l[1:-1]) # Remove 's or "s
raise Exception("Could not parse pyproject.toml")
def prompt_mitigation(msg: str, prompt: str) -> bool:
print("""
--------------------------------------------------------------------------------
!!! INCORRECT OR INCOMPLETE SETUP !!!
--------------------------------------------------------------------------------
""")
print(msg)
print("")
print("Select KEEP if you're seeing this in an error dialog.")
print(f"{prompt} [Y/n] ", end="")
answer = input()
return answer == 'y' or answer == 'Y' or answer == ''
def mitigate_by_pip_install(*args: str) -> None:
import sysView on GitHub (pinned to d5f144c24d)
Solutions
- Restore the literal multi-line 'dependencies = [' block with one quoted entry per line in the module's pyproject.toml.
- Ensure the block has at least the opening and closing lines exactly as the parser expects.
- Avoid reformatting ghidra module pyproject.toml files with generic TOML formatters.
Example fix
# before (in pyproject.toml)
dependencies = ["a", "b"]
# after
dependencies = [
"a",
"b",
] Defensive patterns
Strategy: try-catch
Validate before calling
with open(pyproject) as f:
lines = [l.strip() for l in f]
assert 'dependencies = [' in lines, 'pyproject.toml missing dependencies block' Try / catch
try:
deps = get_module_dependencies(name)
except Exception:
# restore the literal dependencies block, then retry
raise Prevention
- Keep ghidra module pyproject.toml in the expected multi-line format.
- Avoid generic TOML reformatting on these files.
When it happens
Trigger: A pyproject.toml that lists deps under a different key, uses inline arrays ([pkg, pkg]), lacks a dependencies block, or was reformatted (e.g. by a TOML formatter that changes quoting/spaces).
Common situations: Editing pyproject.toml and reformatting it; module whose toml genuinely has no dependencies block; tooling that rewrote the array onto one line.
Related errors
- The parameter '%s' of method '%s' refers to a non-existent s
- Cannot find Python source for {name}. If this is a remote s
- Missing configuration data:
- Could open module data directory
- Unable to parse configuration template
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/4db9c15b28abb494.
Report an issue: GitHub.