tinyhumansai/openhuman · error

Profile {profile_id} belongs to provider {}, not {}

Error message

Profile {profile_id} belongs to provider {}, not {}

What it means

Fires in set_active_profile when the profile id resolved from the requested profile name exists in the store but is registered under a different provider than the one passed in. It is a cross-provider profile-selection guard: the caller asked to activate, e.g., provider A's named profile while the id belongs to provider B, so the activation is refused instead of silently switching a credential across providers.

Source

Thrown at src/openhuman/security/credentials/core.rs:62

    ) -> Result<AuthProfile> {
        let mut profile = AuthProfile::new_token(provider, profile_name, token.to_string());
        profile.metadata.extend(metadata);
        self.store.upsert_profile(profile.clone(), set_active)?;
        Ok(profile)
    }

    pub fn set_active_profile(&self, provider: &str, requested_profile: &str) -> Result<String> {
        let provider = normalize_provider(provider)?;
        let data = self.store.load()?;
        let profile_id = resolve_requested_profile_id(&provider, requested_profile);

        let profile = data
            .profiles
            .get(&profile_id)
            .ok_or_else(|| anyhow::anyhow!("Auth profile not found: {profile_id}"))?;

        if profile.provider != provider {
            anyhow::bail!(
                "Profile {profile_id} belongs to provider {}, not {}",
                profile.provider,
                provider
            );
        }

        self.store.set_active_profile(&provider, &profile_id)?;
        Ok(profile_id)
    }

    pub fn remove_profile(&self, provider: &str, requested_profile: &str) -> Result<bool> {
        let provider = normalize_provider(provider)?;
        let profile_id = resolve_requested_profile_id(&provider, requested_profile);
        self.store.remove_profile(&profile_id)
    }

    pub fn get_profile(
        &self,

View on GitHub (pinned to 7491200858)

Solutions

  1. Pass the provider that actually owns the requested profile (check the profile's provider field).
  2. Use the exact profile id together with its owning provider when selecting by id.
  3. List profiles for the intended provider first to confirm the id/name mapping.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/security/credentials/core.rs:62 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/c17bf223797d789b. Report an issue: GitHub.