jdx/mise · error

workspace provider ID {value:?} cannot contain ':'

Error message

workspace provider ID {value:?} cannot contain ':'

What it means

The provider namespace of a workspace ProjectId must not itself contain `:` because `:` is the namespace separator; a provider like `"np:m"` would make `split_once(':')` ambiguous with the local ID. validate_id_part enforces this only for kind == "provider".

Source

Thrown at src/task/workspace.rs:73

    fn from_str(value: &str) -> Result<Self> {
        let Some((provider, local_id)) = value.split_once(':') else {
            bail!("workspace project ID {value:?} must include a provider namespace");
        };
        Self::new(provider, local_id)
    }
}

fn validate_id_part(kind: &str, value: &str) -> Result<()> {
    if value.is_empty() {
        bail!("workspace {kind} ID cannot be empty");
    }
    if value.trim() != value || value.chars().any(char::is_control) {
        bail!(
            "workspace {kind} ID {value:?} contains surrounding whitespace or control characters"
        );
    }
    if kind == "provider" && value.contains(':') {
        bail!("workspace provider ID {value:?} cannot contain ':'");
    }
    Ok(())
}

/// A project discovered from ecosystem-specific workspace metadata.
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub(crate) struct WorkspaceProject {
    /// Stable identity used by dependency edges and task scoping.
    pub id: ProjectId,
    /// Normalized path relative to the workspace root. `.` represents the root.
    pub root: PathBuf,
    /// Provider-neutral facts that consumers may use for inspection or inference.
    pub metadata: BTreeMap<String, String>,
    /// Projects that this project directly depends on.
    pub dependencies: BTreeSet<ProjectId>,
    /// Provider and metadata source that inferred this project.
    pub provenance: WorkspaceProvenance,
    /// Provider attribution for each inferred dependency edge.

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Pass only the bare provider name (e.g. "npm") to ProjectId::new, not a namespaced string
  2. Check argument order: first arg is provider, second is the local ID
  3. Strip or normalize scheme prefixes (e.g. drop "npm:") before constructing the ID

Example fix

// before
ProjectId::new("npm:pkg", local)?
// after
ProjectId::new("npm", "pkg")?
Defensive patterns

Strategy: validation

Validate before calling

// js: provider must be a bare name without ':'
const isValidProvider = (p) => !p.includes(':') && p.trim() === p && p.length > 0;
if (!isValidProvider('npm')) throw new Error('provider must not contain ":"');

Prevention

When it happens

Trigger: Calling ProjectId::new("np:m", local) or parsing a string whose first `:`-delimited segment itself contains another `:`, e.g. `"a:b:c"` where provider becomes "a:b"... actually from_str splits at the first `:` so this triggers when constructing via new with a colon-bearing provider, or collect_provider_projects passes such a value.

Common situations: Passing a full namespaced ID as the provider argument (`ProjectId::new("npm:pkg", local)`); provider names derived from URLs or scoped identifiers that include colons; mixing up the two arguments of ProjectId::new.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/8d241ba1f01c9c76. Report an issue: GitHub.