Skip to content

Using SF_MDAPI_TEMP_DIR causes 'sf project retrieve' to fail because invalid directory name is generated #3416

@eheyhuron

Description

@eheyhuron

Note
Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

Steps To Reproduce

On a Windows 10-11 machine, set environment variable SF_MDAPI_TEMP_DIR to a valid Windows path. E.g. C:\Temp

Restart terminal windows or VSCode.

Run a valid 'sf project retrieve' command.

Command fails with the following error:
Retrieving v64.0 metadata from example@example.com using the v64.0 SOAP API

✔ Preparing retrieve request 75ms
✔ Sending request to org 939ms
✘ Waiting for the org to respond 1.53s
◼ Done

Status: In Progress
Elapsed Time: 2.49s

Error (MetadataTransferError): Metadata API request failed: ENOENT: no such file or directory, mkdir 'C:\repo\tmp\2025-10-07T18:42:51.205Z_retrieve\metadata'

IMPORTANT
Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue.
We may close your issue if you don't include proper instructions.

  • Generate a project with sf project generate or fork dreamhouse-lwc.
  • Provide detailed step-by-step instructions on how to reproduce the issue.

Tip

use sf doctor --create-issue to automatically fill the required information

Expected result

A directory for debugging should be created

Actual result

It fails to create a directory

Additional information

The reason for the failure is because the directory it tries to create is invalid for windows. The directory attempted to be created is using the ':' character as part of the directory name. This is not a valid character for a directory in windows.

Example result when trying to create the directory 'sf' is attempting:

PS C:\Users\username.sf> mkdir "2025-10-07T18:43:53.809Z_retrieve"
New-Item:
Line |
2 | New-Item -ItemType Directory -Force -Path $args
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find drive. A drive with the name '2025-10-07T18' does not exist.

System Information

Windows 11 Pro, Powershell 7.3.

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.109.6",
  "nodeVersion": "node-v24.9.0",
  "osVersion": "Windows_NT 10.0.22631",
  "rootPath": "C:\\Users\\ehaycraft\\.node\\node_modules\\node_modules\\@salesforce\\cli",
  "shell": "powershell",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.35 (core)",
    "@oclif/plugin-commands 4.1.33 (core)",
    "@oclif/plugin-help 6.2.33 (core)",
    "@oclif/plugin-not-found 3.2.68 (core)",
    "@oclif/plugin-plugins 5.4.48 (core)",
    "@oclif/plugin-search 1.2.32 (core)",
    "@oclif/plugin-update 4.7.8 (core)",
    "@oclif/plugin-version 2.2.33 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.48 (core)",
    "@oclif/plugin-which 3.2.40 (core)",
    "@salesforce/cli 2.109.6 (core)",
    "agent 1.24.13 (core)",
    "apex 3.8.3 (core)",
    "api 1.3.3 (core)",
    "auth 3.9.9 (core)",
    "code-analyzer 5.5.0 (user) published 7 days ago (Tue Sep 30 2025)",
    "custom-metadata 3.3.68 (user) published 30 days ago (Sun Sep 07 2025)",
    "data 4.0.58 (core)",
    "deploy-retrieve 3.23.3 (core)",
    "env 3.0.34 (user) published 324 days ago (Sun Nov 17 2024) (latest is 3.0.37)",
    "functions 1.23.0 (user) published 580 days ago (Tue Mar 05 2024)",
    "info 3.4.88 (core)",
    "limits 3.3.67 (core)",
    "marketplace 1.3.8 (core)",
    "org 5.9.32 (core)",
    "packaging 2.20.5 (core)",
    "schema 3.3.82 (core)",
    "settings 2.4.48 (core)",
    "signups 2.6.49 (user) published 10 days ago (Sat Sep 27 2025)",
    "sobject 1.4.73 (core)",
    "telemetry 3.6.58 (core)",
    "templates 56.3.65 (core)",
    "trust 3.7.113 (core)",
    "user 3.6.38 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.2.1 (user) published 367 days ago (Fri Oct 04 2024)",
    "@salesforce/sfdx-scanner 4.12.0 (user) published 161 days ago (Tue Apr 29 2025)",
    "@venkat.polisetti/crm-sfdx-plugin 2.0.9 (user) published 2440 days ago (Thu Jan 31 2019)",
    "lightning-flow-scanner 5.6.2 (user) published 1 days ago (Mon Oct 06 2025)",
    "sfdmu 4.38.0 (user) published 282 days ago (Sun Dec 29 2024)",
    "sfdx-git-delta 6.3.0 (user) published 245 days ago (Tue Feb 04 2025) (latest is 6.21.0)"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a buginvestigatingWe're actively investigating this issuevalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions