Hmbown/CodeWhale · error

ConfigStore path is validated before construction

Error message

ConfigStore path is validated before construction

What it means

permissions_path() derives the permissions file location from the store's config path and unwraps with this expect because ConfigStore construction already validated that path. The panic fires only if a ConfigStore was built through a path that bypassed validation — an internal-contract violation.

Solutions

  1. Ensure all ConfigStore instances are created via the validated load() constructor
  2. Fix any code that mutates the config path after construction
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/config/src/lib.rs:5223 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/7ea50362e90b25ea. Report an issue: GitHub.

Appendix: source

Thrown at crates/config/src/lib.rs:5223

    pub fn reload(&mut self) -> Result<()> {
        *self = Self::load(Some(self.path.clone()))?;
        Ok(())
    }

    #[must_use]
    pub fn path(&self) -> &Path {
        &self.path
    }

    #[must_use]
    pub fn permissions(&self) -> &PermissionsToml {
        &self.permissions
    }

    #[must_use]
    pub fn permissions_path(&self) -> PathBuf {
        checked_permissions_path_for_config_path(&self.path)
            .expect("ConfigStore path is validated before construction")
    }

    #[must_use]
    pub fn exec_policy_engine(&self) -> ExecPolicyEngine {
        if self.permissions.is_empty() {
            ExecPolicyEngine::new(Vec::new(), Vec::new())
        } else {
            ExecPolicyEngine::with_rulesets(vec![self.permissions.ruleset()])
        }
    }

    /// Atomically append ask-only permission rules to the sibling
    /// `permissions.toml` file.
    ///
    /// Existing comments and formatting are preserved. Exact duplicate rules
    /// are ignored, and the in-memory permissions snapshot is refreshed after
    /// a successful write.
    pub fn append_ask_rules(&mut self, rules: &[ToolAskRule]) -> Result<usize> {

View on GitHub (pinned to 0c42157ee5)