GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug]: macOS font discovery raises KeyError('_items') for an incomplete system_profiler font record · Issue #32328 · matplotlib/matplotlib

[Bug]: macOS font discovery raises KeyError('_items') for an incomplete system_profiler font record #32328

New issue
Copy link
New issue
Copy link
Open
Open
[Bug]: macOS font discovery raises KeyError('_items') for an incomplete system_profiler font record#32328
Copy link
Labels
OS: Applefirst-contributionstatus: needs clarificationIssues that need more information to resolve.Issues that need more information to resolve.topic: text/fonts

Description

@iskandr
iskandr
opened on Sep 9, 2026
Issue body actions

Summary

On macOS arm64, importing matplotlib.pyplot through DNA Chisel during a command-line smoke test failed in _get_macos_fonts with KeyError: '_items'. Matplotlib is 3.10.8, Python 3.12.6. The process was running with restricted filesystem access; Matplotlib could not write its default cache directory and created a temporary cache before scanning fonts.

The current implementation catches subprocess/plist parsing errors but assumes every successfully decoded record contains _items:
https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/font_manager.py

Minimal parser-boundary reproduction

In an environment where font_manager can already be imported:

import plistlib
from unittest.mock import patch
from matplotlib import font_manager

font_manager._get_macos_fonts.cache_clear()
payload = plistlib.dumps([{"_name": "Fonts"}])
with patch("subprocess.check_output", return_value=payload):
    font_manager._get_macos_fonts()

The payload is a minimal synthetic reproduction of the missing-key condition, not a capture of the entire system_profiler response. The actual CLI traceback ended at:

font_manager.py, in _get_macos_fonts
    return [Path(entry["path"]) for entry in d["_items"]]
KeyError: '_items'

Expected behavior

Treat unavailable/incomplete system font discovery as an empty or partial result, consistent with the existing OSError/subprocess-error fallbacks, rather than making pyplot import fail. A regression could cover missing _items and entries without a path.

This is a robustness report; no change to font selection semantics is requested when system_profiler returns a complete record. Downstream discovery: openvax/vaxrank#428.

Activity

  1. github-actions
    added
    first-contribution
    on Sep 9, 2026
  2. iccir
    added
    OS: Apple
    topic: text/fonts
    on Sep 9, 2026
  3. iccir commented on Sep 9, 2026

    @iccir
    iccir
    on Sep 9, 2026
    Contributor
    More actions

    Likely fixed by #31977

  4. iccir commented on Sep 10, 2026

    @iccir
    iccir
    on Sep 10, 2026
    Contributor
    More actions

    This specific error isn't going to occur after #31977, as we no longer use system_profiler or parse a plist. Can you provide more information about "The process was running with restricted filesystem access"? I want to ensure that our new approach using CoreText handles this case.

  5. iccir
    added
    status: needs clarificationIssues that need more information to resolve.Issues that need more information to resolve.
    on Sep 13, 2026
  6. iskandr commented on Oct 9, 2026

    @iskandr
    iskandr
    on Oct 9, 2026
    Author
    More actions

    This remains reproducible with Matplotlib 3.11.2 on macOS / Python 3.12.6 in the Tsarina canine-report validation. A cold-cache full run had 708 passing tests and four failures ending in _get_macos_fonts -> d['_items'] -> KeyError('_items'), including one existing human plotting test. The standalone report CLI failed at the same parser boundary. No raw system-profiler/font inventory is attached.

    A matching local font cache (format 3.11.0) in an explicit writable MPLCONFIGDIR loads and renders SVG successfully; this is the temporary test-environment recovery, not a patch to Matplotlib. The source still directly indexes d['_items'] after its subprocess/plist-error handlers. Missing-key discovery should degrade to unavailable/partial system fonts rather than prevent pyplot import, as requested in the original issue.

  7. iccir commented on Oct 9, 2026

    @iccir
    iccir
    on Oct 9, 2026
    Contributor
    More actions

    This will not be fixed until 3.12.

    Can you please elaborate on "The process was running with restricted filesystem access" from the original description. I want to make sure that our new path in 3.12 fixes this. Thank you!

  8. TimidRobot
    added a commit that references this issue on Oct 21, 2026

    pin matplotlib at 3.10 until matplotlib/matplotlib#32328 is resolved

    d3eacf5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS: Applefirst-contributionstatus: needs clarificationIssues that need more information to resolve.Issues that need more information to resolve.topic: text/fonts

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.