{"record":{"id":"9cc05c92f95cb20e","repo":"microsoft/semantic-kernel","slug":"error-loading-the-manifest-messages","errorCode":null,"errorMessage":"Error loading the manifest: {messages}","messagePattern":"Error loading the manifest: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Functions/Functions.OpenApi.Extensions/Extensions/CopilotAgentPluginKernelExtensions.cs","lineNumber":89,"sourceCode":"        if (!File.Exists(filePath))\n        {\n            throw new FileNotFoundException($\"CopilotAgent file not found: {filePath}\");\n        }\n\n        var loggerFactory = kernel.LoggerFactory;\n        var logger = loggerFactory.CreateLogger(typeof(CopilotAgentPluginKernelExtensions)) ?? NullLogger.Instance;\n        using var CopilotAgentFileJsonContents = DocumentLoader.LoadDocumentFromFilePathAsStream(filePath,\n            logger);\n\n        var results = await PluginManifestDocument.LoadAsync(CopilotAgentFileJsonContents, new ReaderOptions\n        {\n            ValidationRules = [] // Disable validation rules\n        }).ConfigureAwait(false);\n\n        if (!results.IsValid)\n        {\n            var messages = results.Problems.Select(static p => p.Message).Aggregate(static (a, b) => $\"{a}, {b}\");\n            throw new InvalidOperationException($\"Error loading the manifest: {messages}\");\n        }\n\n        var document = results.Document;\n        var openAPIRuntimes = document?.Runtimes?.Where(runtime => runtime.Type == RuntimeType.OpenApi).ToList();\n        if (openAPIRuntimes is null || openAPIRuntimes.Count == 0)\n        {\n            throw new InvalidOperationException(\"No OpenAPI runtimes found in the manifest.\");\n        }\n\n        var functions = new List<KernelFunction>();\n        var documentWalker = new OpenApiWalker(new OperationIdNormalizationOpenApiVisitor());\n        foreach (var runtime in openAPIRuntimes)\n        {\n            var manifestFunctions = document?.Functions?.Where(f => runtime.RunForFunctions.Contains(f.Name)).ToList();\n            if (manifestFunctions is null || manifestFunctions.Count == 0)\n            {\n                logger.LogWarning(\"No functions found in the runtime object.\");\n                continue;","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.OpenApi.Extensions/Extensions/CopilotAgentPluginKernelExtensions.cs#L71-L107","documentation":"Thrown by CreatePluginFromCopilotAgentPluginAsync when PluginManifestDocument.LoadAsync reports the Copilot Agent Plugin manifest (api-plugin-v2_0.json shape) as invalid. The message aggregates every Problem.Message returned by the loader into a comma-separated list, so it lists all schema/parsing defects found in one pass.","triggerScenarios":"Loading a Copilot Agent Plugin manifest JSON that is structurally invalid against the PluginManifest schema - missing required fields (name, runtimes), malformed JSON syntax, or a top-level array where an object is expected. ValidationRules are disabled in the reader, so failures come from the manifest model binding itself, not from custom rules.","commonSituations":"Hand-editing the manifest and breaking the JSON; using a manifest written for a newer/older schema version; copy-pasting an example that omitted required properties; trailing commas or single quotes (JSON, not JSONC); the file is actually an OpenAPI doc rather than a plugin manifest.","solutions":["Read the aggregated messages string in the exception - it names the specific fields that failed (e.g. required 'runtimes', 'name').","Validate the JSON syntactically first (run it through a JSON linter) and against the Copilot Agent Plugin manifest schema.","Confirm the top-level structure: schema, name, description, runtimes (with type OpenApi), and functions.","Make sure you are pointing at the plugin manifest (api-plugin-v2_0.json), not the OpenAPI spec it references."],"exampleFix":"// before - wrong file type\nawait kernel.ImportPluginFromCopilotAgentPluginAsync(\"P\", \"openapi.json\");\n\n// after - point at the plugin manifest whose runtimes reference the OpenAPI spec\nawait kernel.ImportPluginFromCopilotAgentPluginAsync(\"P\", \"api-plugin-v2_0.json\");","handlingStrategy":"validation","validationCode":"using var stream = File.OpenRead(filePath);\nvar preview = await new StreamReader(stream).ReadToEndAsync(); stream.Position = 0;\ntry { JsonNode.Parse(preview); } catch (JsonException ex) { throw new InvalidOperationException($\"Manifest JSON is invalid: {ex.Message}\"); }","typeGuard":null,"tryCatchPattern":"try { await kernel.ImportPluginFromCopilotAgentPluginAsync(name, path, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Error loading the manifest\"))\n{ logger.LogError(ex, \"Manifest failed validation: {Messages}\", ex.Message); throw; }","preventionTips":["Lint the manifest JSON before runtime.","Keep a canonical, known-good manifest as a structural reference.","Ensure the file is the plugin manifest, not the OpenAPI spec."],"tags":["copilot-agent-plugin","manifest","validation","json"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}