Skip to content

Windows: ENOENT mkdir '\\?' error in Telegram handler #44199

@dirtysouthalpha

Description

@dirtysouthalpha

Bug type

Regression (worked before, now fails)

Summary

Bug Description

On Windows, the Telegram handler fails with an ENOENT error when trying to create a directory with an invalid path
\?.

Error Message

Error: ENOENT: no such file or directory, mkdir '?'

Environment

  • OS: Windows Server 2022
  • OpenClaw Version: 2026.3.11 (29dc654)
  • Node Version: 22.17.0

Steps to Reproduce

  1. Install OpenClaw v2026.3.11 on Windows
  2. Configure Telegram channel with bot token
  3. Start gateway: openclaw gateway
  4. Send a message to the bot via Telegram

Expected Behavior

Telegram messages should be processed without directory creation errors.

Actual Behavior

The following error appears intermittently in the logs:

[gateway/channels/telegram] telegram dispatch failed: Error: ENOENT: no such file or directory, mkdir '?'
[gateway/heartbeat] heartbeat failed: ENOENT: no such file or directory, mkdir '?'

The error is non-fatal - messages still deliver successfully (sendMessage ok appears right after). However,
it clutters logs and indicates a path handling bug.

Root Cause

The \? is an incomplete Windows extended-length path prefix. The code appears to be constructing a path that
results in just \? instead of a full path like \?\C:\path\to\dir.

This likely affects file download/attachment handling in the Telegram subsystem.

Suggested Fix

Ensure Windows paths are properly constructed with the full extended-length path format, or use standard paths
without the \? prefix when not needed.

Steps to reproduce

  1. Install OpenClaw v2026.3.11 on Windows
  2. Configure Telegram channel with bot token
  3. Run: openclaw gateway
  4. Send any message to the bot via Telegram

Expected behavior

Messages processed without directory creation errors; clean logs

Actual behavior

Error logged: "ENOENT: no such file or directory, mkdir '\?'" appears intermittently. Messages still deliver but
logs are cluttered with errors.

OpenClaw version

2026.3.11

Operating system

Windows Server 2022

Install method

npm global

Model

zai/glm-5

Provider / routing chain

openclaw>z.ai

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

From C:\tmp\openclaw\openclaw-2026-03-12.log:

  {"subsystem":"gateway/channels/telegram","1":"telegram dispatch failed: Error: ENOENT: no such file or directory,
  mkdir '\\?'"}
  {"subsystem":"gateway/channels/telegram","1":"telegram sendMessage ok chat=7178939484 message=426"}

  {"subsystem":"gateway/heartbeat","1":{"error":"ENOENT: no such file or directory, mkdir '\\?'"},"2":"heartbeat
  failed: ENOENT: no such file or directory, mkdir '\\?'"}

Impact and severity

Affected: All Windows users with Telegram channel
Severity: Medium (non-blocking but log pollution, potential edge cases)
Frequency: Intermittent (appears during message dispatch/heartbeat)
Consequence: No functional impact but logs are polluted; potential issues with file downloads/attachments

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions