{"record":{"id":"57303fc8569bfebd","repo":"microsoft/aspire","slug":"aspire-skills-bundle-was-not-resolved-for-skill-skill-name","errorCode":null,"errorMessage":"Aspire skills bundle was not resolved for skill '{skill.Name}'.","messagePattern":"Aspire skills bundle was not resolved for skill '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Commands/AgentInitCommand.cs","lineNumber":765,"sourceCode":"        var displayRelativeSkillDirectory = relativeSkillDirectory\n            .Replace(Path.DirectorySeparatorChar, '/')\n            .Replace(Path.AltDirectorySeparatorChar, '/');\n\n        return isUserLevel ? $\"~/{displayRelativeSkillDirectory}\" : displayRelativeSkillDirectory;\n    }\n\n    private static async Task<IReadOnlyList<SkillAssetFile>> GetSkillFilesAsync(SkillDefinition skill, AspireSkillsBundle? aspireSkillsBundle, CancellationToken cancellationToken)\n    {\n        if (skill.SkillContent is not null)\n        {\n            return [new SkillAssetFile(\"SKILL.md\", skill.SkillContent)];\n        }\n\n        if (skill.SourceKind is SkillSourceKind.AspireSkillsBundle)\n        {\n            if (aspireSkillsBundle is null)\n            {\n                throw new InvalidOperationException($\"Aspire skills bundle was not resolved for skill '{skill.Name}'.\");\n            }\n\n            return await aspireSkillsBundle.GetSkillFilesAsync(skill, cancellationToken);\n        }\n\n        throw new InvalidOperationException($\"Skill '{skill.Name}' does not define installable files.\");\n    }\n\n    private sealed record InstalledSkillSummaryItem(string SkillName, string DisplayLocation);\n\n    private readonly record struct SkillInstallResult(bool Succeeded, InstalledSkillSummaryItem? UpdatedSkill);\n}\n\ninternal readonly record struct AgentInitExecutionResult(\n    int ExitCode,\n    IReadOnlyList<SkillLocation> SelectedLocations,\n    IReadOnlyList<SkillDefinition> SelectedSkills);\n","sourceCodeStart":747,"sourceCodeEnd":783,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Commands/AgentInitCommand.cs#L747-L783","documentation":"AgentInitCommand throws this InvalidOperationException when a skill declares SkillSourceKind.AspireSkillsBundle, but the aspireSkillsBundle instance was never resolved and passed into GetSkillFilesAsync. It is a guard against an internally inconsistent state: the skill claims to come from the Aspire skills bundle, yet no bundle is available to fetch its files from.","triggerScenarios":"Calling GetSkillFilesAsync (via skillFiles) with a skill whose SourceKind is AspireSkillsBundle while the aspireSkillsBundle argument is null — e.g. bundle resolution/discovery failed or was skipped earlier in the command pipeline but the skill list still contains bundle-sourced skills.","commonSituations":"Running 'aspire agent init' with skills configured from the Aspire skills bundle when the bundle was not downloaded, not found, or an earlier resolution step silently returned null; corrupted or missing bundle cache.","solutions":["Ensure the Aspire skills bundle is resolved (downloaded/cached) before enumerating skills, and skip bundle-sourced skills if resolution fails","Check why aspireSkillsBundle was null: fix the resolution step so it either throws early with a clear message or filters out AspireSkillsBundle skills","Update the Aspire CLI to the latest version in case bundle resolution had a bug"],"exampleFix":"// before\nif (aspireSkillsBundle is null)\n{\n    throw new InvalidOperationException($\"Aspire skills bundle was not resolved for skill '{skill.Name}'.\");\n}\n// after\nif (aspireSkillsBundle is null)\n{\n    _logger.LogWarning(\"Skipping skill '{SkillName}': Aspire skills bundle is unavailable.\", skill.Name);\n    return null; // or filter such skills before calling GetSkillFilesAsync\n}","handlingStrategy":"validation","validationCode":"if (skill.SourceKind is SkillSourceKind.AspireSkillsBundle && aspireSkillsBundle is null)\n{\n    throw new InvalidOperationException($\"Aspire skills bundle must be resolved before installing '{skill.Name}'.\");\n}","typeGuard":"if (skill.SourceKind is SkillSourceKind.AspireSkillsBundle && aspireSkillsBundle is null) { /* skip or resolve first */ }","tryCatchPattern":"try\n{\n    await GetSkillFilesAsync(skill, bundle, ct);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"skills bundle was not resolved\"))\n{\n    logger.LogWarning(ex, \"Skipping skill {Skill}: bundle unavailable\", skill.Name);\n}","preventionTips":["Resolve the skills bundle before enumerating/installing skills","Filter out AspireSkillsBundle skills when the bundle is null","Log bundle resolution failures early instead of passing null downstream"],"tags":["cli","aspire","skills-bundle"],"backgroundTag":"internal-invariant-violation","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}