Skip to content

metaclaw-openclaw: PLUGIN_DIR uses URL pathname; venv creation fails on Windows with spaces in path #70

@Noopy420

Description

@Noopy420

Summary

new URL(import.meta.url).pathname on Windows returns a URL-encoded path with a leading / that doesn't round-trip back to a usable filesystem path. When the plugin then calls path.join(PLUGIN_DIR, ".metaclaw"), the resulting venv path looks like \C:\Users\Evo%20X2%20-%20NoopAI\.openclaw\extensions\metaclaw-openclaw\.metaclaw, and the underlying syscall fails with [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\C:'.

Reproduction

  • Windows 10/11
  • User profile (or any ancestor path component) contains spaces — e.g. Evo X2 - NoopAI
  • Install the plugin, start the gateway
  • Plugin doctor reports:
metaclaw-openclaw: creating venv at \C:\Users\Evo%20X2%20-%20NoopAI\.openclaw\extensions\metaclaw-openclaw\.metaclaw using python3…
metaclaw-openclaw: venv creation failed. stderr:
Error: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\C:'

Affected lineindex.ts:13

const PLUGIN_DIR = path.dirname(new URL(import.meta.url).pathname);

Fix — use fileURLToPath from node:url, which decodes percent-encoding and strips the leading / correctly:

import { fileURLToPath } from "node:url";
const PLUGIN_DIR = path.dirname(fileURLToPath(import.meta.url));

Verified locally on Windows 11 — venv creates cleanly with the patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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