Skip to content

python logpoints: a literal % in the message text makes every hit log "unsupported format character" instead of the message #1349

Done

Description

@debugmcpdev

Found on 2026-11-28 while reviewing #1346, with real logpoints through the built server against debugpy 1.8.20 on Python 3.13. The behaviour is on main.

What happens

A Python logpoint whose message has a literal % in its text and at least one {…} group logs an error instead of the message:

logMessage: "done 100% {x}"
logged:     unsupported format character '%' (0x…) at index …

debugpy turns the message into the expression '<text with %s for each group>' % (g1, g2, …,) and does not escape a % that is part of the text, so Python's % formatting reads it as a format directive. A message with no group is not formatted and keeps its %.

Expected

What the caller wrote is what is logged. The Python policy can double a literal % in the text parts of a message that has groups before it goes to the adapter (the policy already has a hook for the wire form of a breakpoint, which JavaScript uses), and leave a message without groups as it is. The defect itself is debugpy's and should be reported there with the two-line reproduction.

Related: #1334 (messages with f-string syntax), #1346.

Class: a call that succeeds and logs only an error. Path: Python logpoints with a % in the text (progress messages, percentages).

Activity

  1. added
    bug
    python
    on Nov 28, 2026
  2. debugmcpdev commented on Nov 28, 2026

    @debugmcpdev
    CollaboratorAuthor

    The same class in other engines, measured on 2026-11-28 for the logpoint design note (the engine's template syntax reads the agent's literal text):

    • Go (Delve): the message's text is handed to Sprintf. 100% {x} logs 100%s%!(EXTRA string="café").
    • Dart (the SDK's adapter): $ is its own interpolation. cost $5 {x} fails at every hit and then logs a line reading null.
    • JavaScript: x=${x} logs x=$café (the $ is text and {x} the field); documented behaviour, listed because agents write template-literal syntax.

    For Python the design in review removes this for a message that fails as written (100% {x} then logs 100% café). Go needs a fix in Delve; Dart's is the SDK adapter's design and wants a sentence in the guide.

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

    bugpython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions