openclaw - 💡(How to fix) Fix [Bug]: parseIdentityMarkdown rejects avatar paths wrapped in markdown code spans (backticks)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

parseIdentityMarkdown strips leading/trailing * and _ from field values but not backticks, so an avatar declared as - **Avatar:** `avatars/foo.png` is parsed as the literal string `avatars/foo.png`. path.extname then returns .png` (trailing backtick), which fails isSupportedLocalAvatarExtension, and the Control UI shows "Unsupported image type".

Error Message

  1. Observe the avatar slot showing the error "Unsupported image type".
  • Severity: Low — affects display only, easy workaround (remove backticks). The misleading error message ("Unsupported image type") does not hint at the real cause (markdown parsing).

Root Cause

parseIdentityMarkdown strips leading/trailing * and _ from field values but not backticks, so an avatar declared as - **Avatar:** `avatars/foo.png` is parsed as the literal string `avatars/foo.png`. path.extname then returns .png` (trailing backtick), which fails isSupportedLocalAvatarExtension, and the Control UI shows "Unsupported image type".

Fix Action

Fix / Workaround

  • Affected: any user who writes their avatar path as a markdown code span (which is the natural convention for file paths in markdown).
  • Severity: Low — affects display only, easy workaround (remove backticks). The misleading error message ("Unsupported image type") does not hint at the real cause (markdown parsing).
  • Frequency: Deterministic when the value is wrapped in backticks.

Code Example

- **Avatar:** `avatars/ksorayn.png`

---

const value = cleaned
  .slice(colonIndex + 1)
  .replace(/^[*_]+|[*_]+$/g, "")   // strips *, _ — but not `
  .trim();

---

# Before (IDENTITY.md uses backticks):
parsed identity.avatar = "`avatars/ksorayn.png`"
extname                = ".png`"
extension supported?   = false  → reason: "unsupported_extension"

# After removing the backticks in IDENTITY.md:
parsed identity.avatar = "avatars/ksorayn.png"
extname                = ".png"
extension supported?   = true

---

// before
.replace(/^[*_]+|[*_]+$/g, "")
// after
.replace(/^[*_`]+|[*_`]+$/g, "")
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

parseIdentityMarkdown strips leading/trailing * and _ from field values but not backticks, so an avatar declared as - **Avatar:** `avatars/foo.png` is parsed as the literal string `avatars/foo.png`. path.extname then returns .png` (trailing backtick), which fails isSupportedLocalAvatarExtension, and the Control UI shows "Unsupported image type".

Steps to reproduce

  1. In a workspace, edit IDENTITY.md and set the avatar with a markdown code span:
    - **Avatar:** `avatars/ksorayn.png`
    Place a valid PNG at <workspace>/avatars/ksorayn.png.
  2. Restart the gateway / refresh the Control UI.
  3. Observe the avatar slot showing the error "Unsupported image type".

Expected behavior

The parser should treat a value wrapped in a markdown code span (`value`) the same as a value wrapped in **value** or _value_ — i.e., strip the formatting and use value. The avatar should render. Plain text values (no backticks) already work correctly today.

Actual behavior

The value reaches the avatar policy with the trailing backtick still attached. The policy rejects it as unsupported_extension, surfaced in the UI as "Unsupported image type". Same value without backticks renders correctly.

Verified against src/agents/identity-file.ts on main:

const value = cleaned
  .slice(colonIndex + 1)
  .replace(/^[*_]+|[*_]+$/g, "")   // strips *, _ — but not `
  .trim();

OpenClaw version

2026.5.22

Operating system

Ubuntu 26.04 LTS

Install method

pnpm global

Model

ollama/qwen3 (irrelevant to bug — parser is model-agnostic)

Provider / routing chain

openclaw -> ollama (irrelevant to bug)

Logs, screenshots, and evidence

# Before (IDENTITY.md uses backticks):
parsed identity.avatar = "`avatars/ksorayn.png`"
extname                = ".png`"
extension supported?   = false  → reason: "unsupported_extension"

# After removing the backticks in IDENTITY.md:
parsed identity.avatar = "avatars/ksorayn.png"
extname                = ".png"
extension supported?   = true

Impact and severity

  • Affected: any user who writes their avatar path as a markdown code span (which is the natural convention for file paths in markdown).
  • Severity: Low — affects display only, easy workaround (remove backticks). The misleading error message ("Unsupported image type") does not hint at the real cause (markdown parsing).
  • Frequency: Deterministic when the value is wrapped in backticks.

Additional information

Suggested fix: include the backtick character in the formatting-strip character class used by normalizeIdentityValue and by the value-extraction step in parseIdentityMarkdown, so that backticks are stripped alongside * and _:

// before
.replace(/^[*_]+|[*_]+$/g, "")
// after
.replace(/^[*_`]+|[*_`]+$/g, "")

Happy to send a PR.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The parser should treat a value wrapped in a markdown code span (`value`) the same as a value wrapped in **value** or _value_ — i.e., strip the formatting and use value. The avatar should render. Plain text values (no backticks) already work correctly today.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: parseIdentityMarkdown rejects avatar paths wrapped in markdown code spans (backticks)