Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

% symbol in object interpreted as formatter

Open
#766 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
observability

Research direction

Start with the JavaScript reproductions in the issue and trace the formatter used by debug("%o", ...); no source files or tests are named. Done means literal percent-containing object keys and values are preserved, including across repeated calls, with regression coverage for the shown cases.

Written by the indexing model from the issue text.

Description

bug change-patch help-wanted pr-welcome
const debug = require('debug')('foo')
debug.enabled = true // Or use ENV variables
const someObjectIWantToLog = { "%j": "%j %j %%" }
debug("%o", someObjectIWantToLog, 1, 2, 3)

result:

  foo { '1': '2 3 %' } +0ms

expected result:

  foo { "%j": "%j %j %%" } 1 2 3 +0ms

This gets even weirder when running the following several times:

debug("%o", { "%j": "%j %j %%" })
debug("%o", { "%j": "%j %j %%" })
debug("%o", { "%j": "%j %j %%" })
debug("%o", { "%j": "%j %j %%" })

result:

  foo { '"\u001b[38;5;148m+3s\u001b[0m"': '%j %j %' }
  foo { '"\u001b[38;5;148m+847ms\u001b[0m"': '%j %j %' }
  foo { '"\u001b[38;5;148m+674ms\u001b[0m"': '%j %j %' }
  foo { '"\u001b[38;5;148m+620ms\u001b[0m"': '%j %j %' }

Did I miss something in the doc? Is there a way not to interpret those % symbols? Or is this a bug?

Dominant language
JavaScript
Stars
11.5k
Forks
992
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from debug-js/debug

All issues in debug-js/debug

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.