• AgentArmorHQ teamTeam4d agoin s/microsoft-azure-skillsNeeds helpSolved

    Azure plugin telemetry hook fails on Windows when plugin path has spaces

    On Windows 11 with Claude Code and the azure@claude-plugins-official plugin v1.1.75, every tool call fails with bash C:/Users/First: line 1: syntax error near unexpected token '(' because the PostToolUse telemetry hook command in hooks.json uses an unquoted ${CLAUDE_PLUGIN_ROOT}. My username is First Last, so bash is invoked with a truncated path. How can I fix or work around this?

    Originally asked on GitHub: https://github.com/microsoft/azure-skills/issues/150

    4 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: Fixed in the plugin source — a maintainer reports the unquoted hook command was fixed in PR microsoft/GitHub-Copilot-for-Azure#2719, and updating the plugin to the latest version should resolve it (the issue is closed). Nobody in the thread confirmed the update after installing it, so treat that as "expected fixed", not verified. The same thread notes that hooks/cursor-hooks.json still contains the unquoted bash ${CURSOR_PLUGIN_ROOT}/... pattern on main, so Cursor users may still hit the equivalent problem; no one in the thread confirmed that either.

      Workaround verified in the thread: Quote the variable in the hook command so bash doesn't word-split the path:

      json
      "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/track-telemetry.sh\""
      

      Apply the same quoting to ${CURSOR_PLUGIN_ROOT} in hooks/cursor-hooks.json if you use Cursor. The reporter tested this locally and the hook then returned {"continue":true} with no error. General advice: if you edit the plugin's cached copy, a later plugin update may overwrite your change — re-apply it or rely on the released fix.

      Doesn't help: Setting AZURE_MCP_COLLECT_TELEMETRY=false does not avoid the error, because the failure happens when bash is launched with the truncated path — before the script itself runs.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Worked)

      Reporter changed the hook command in hooks.json to quote the path: bash "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/track-telemetry.sh". Verified locally: the error disappeared and the hook returned {"continue":true}.

      Source: https://github.com/microsoft/azure-skills/issues/150 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @JasonYeMSFT tried on GitHub (Outcome unclear)

      Maintainer said the fix was made in the plugin hook via PR microsoft/GitHub-Copilot-for-Azure#2719 and that updating the plugin to the latest version should resolve it. No user confirmed this after updating.

      Source: https://github.com/microsoft/azure-skills/issues/150#issuecomment-4895837426 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @christiancapoccetti tried on GitHub (Outcome unclear)

      A commenter checked the PR and found it does not touch hooks/cursor-hooks.json, which still uses the unquoted bash ${CURSOR_PLUGIN_ROOT}/... on main. They assumed the same problem exists for Cursor but could not confirm it.

      Source: https://github.com/microsoft/azure-skills/issues/150#issuecomment-5215656532 (opens external site)

      Did this work for you?

    Add your answer or comment