{"record":{"id":"3023dfbc480929c1","repo":"GitoxideLabs/gitoxide","slug":"populated-above","errorCode":null,"errorMessage":"populated above","messagePattern":"populated above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix/src/submodule/mod.rs","lineNumber":78,"sourceCode":"    ) -> Result<(RefMut<'_, IsActivePlatform>, RefMut<'_, gix_worktree::Stack>), is_active::Error> {\n        let mut state = self.is_active.borrow_mut();\n        if state.is_none() {\n            let platform = self\n                .modules\n                .is_active_platform(&self.repo.config.resolved, self.repo.config.pathspec_defaults()?)?;\n            let index = self.index()?;\n            let attributes = self\n                .repo\n                .attributes_only(\n                    &index,\n                    gix_worktree::stack::state::attributes::Source::WorktreeThenIdMapping\n                        .adjust_for_bare(self.repo.is_bare()),\n                )?\n                .detach();\n            *state = Some(IsActiveState { platform, attributes });\n        }\n        Ok(RefMut::map_split(state, |opt| {\n            let state = opt.as_mut().expect(\"populated above\");\n            (&mut state.platform, &mut state.attributes)\n        }))\n    }\n}\n\nstruct IsActiveState {\n    platform: IsActivePlatform,\n    attributes: gix_worktree::Stack,\n}\n\n///Access\nimpl Submodule<'_> {\n    /// Return the submodule's configured name as it appears in `submodule.<name>.*`.\n    ///\n    /// Note that this name is not guaranteed to be valid and may contain traversal components if\n    /// the configuration was crafted manually.\n    ///\n    /// Use [`validated_name()`](Self::validated_name()) to obtain a validated submodule name.","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix/src/submodule/mod.rs#L60-L96","documentation":"`Submodule::active_state_mut()` lazily populates an internal `IsActiveState` cache and then unwraps it with `expect(\"populated above\")`. The panic indicates the lazy-population loop above failed to set the state despite the code path assuming it did — an internal invariant of the submodule caching logic. It should be unreachable for correct inputs.","triggerScenarios":"Calling `active_state_mut()` on a submodule whose active-state computation returned without populating the cache; practically unreachable but reachable if submodule lookup or config parsing silently produces an empty state (e.g. a submodule entry whose path/config lookups misbehave).","commonSituations":"Working in repositories with hand-edited `.gitmodules` or `.git/config` submodule sections that don't match the index; unusual submodule setups where the name-to-path mapping is inconsistent.","solutions":["Report this as a bug to gitoxide with the repository reproducing it — the invariant assumes population always happens.","Work around by using the non-mut `active_state()`/platform accessors if available, or re-open the repository.","Sanitize submodule config: ensure each `.gitmodules` entry has a matching `submodule.<name>.path`/`url` in `.git/config` or is absent entirely."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure submodule exists in index and .gitmodules\nlet subs = repo.submodules()?; // iterate instead of hand-crafted lookups\n","typeGuard":null,"tryCatchPattern":"match repo.submodules() { Ok(subs) => ..., Err(e) => eprintln!(\"submodule access failed: {e}\") } // panics abort the process; guard inputs instead\n","preventionTips":["Keep .gitmodules and .git/config submodule sections consistent","Report panics in this accessor to gitoxide with a repro repo","Prefer higher-level repo.submodules()/platform APIs over direct state mutation"],"tags":["panic","internal-invariant","submodule","git"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}