MemPalace/mempalace · error · ValueError
{path} is malformed: {exc}
Error message
{path} is malformed: {exc} What it means
Error "{path} is malformed: {exc}" thrown in MemPalace/mempalace.
Source
Thrown at mempalace/transport.py:82
return float(os.environ.get("MEMPALACE_SYNC_HTTP_TIMEOUT", "") or _HTTP_TIMEOUT_S)
except ValueError:
return float(_HTTP_TIMEOUT_S)
def load_peers(palace_path: str) -> list[dict]:
"""Read peers.json; [] when absent. Malformed files fail loudly.
peers.json is TRANSPORT configuration — addressing plus app-layer
authorization — which is why it lives on this side of the seam.
"""
path = Path(os.path.expanduser(palace_path)) / PEERS_FILENAME
if not path.exists():
return []
try:
data = json.loads(path.read_text(encoding="utf-8"))
peers = data["peers"]
except (ValueError, KeyError, TypeError) as exc:
raise ValueError(f"{path} is malformed: {exc}") from None
if not isinstance(peers, list):
raise ValueError(f"{path}: 'peers' must be a list")
for peer in peers:
if not isinstance(peer, dict) or not peer.get("url"):
raise ValueError(f"{path}: every peer needs at least a 'url'")
return peers
def http_request(base_url: str, token: str, path: str, params: dict = None) -> dict:
"""The HTTPS wire primitive: one bearer-authenticated GET, JSON back."""
url = base_url.rstrip("/") + path
if params:
url += "?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url)
if token:
request.add_header("Authorization", f"Bearer {token}")
try:
with urllib.request.urlopen(request, timeout=_http_timeout_s()) as response:View on GitHub (pinned to 06cb6987f0)
Solutions
- Fix the peers file so it parses as valid config
When it happens
Trigger: Thrown at mempalace/transport.py:82 when the library encounters an invalid state.
Common situations: Transport peers config file is malformed.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/84f8d379ec92190b.
Report an issue: GitHub.