{"record":{"id":"c0589f6fbb94811f","repo":"microsoft/semantic-kernel","slug":"error-loading-the-manifest-messages-c0589f","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/DeclarativeAgentExtensions.cs","lineNumber":56,"sourceCode":"        where T : Agent, new()\n    {\n        Verify.NotNull(kernel);\n        Verify.NotNullOrWhiteSpace(filePath);\n\n        var loggerFactory = kernel.LoggerFactory;\n        var logger = loggerFactory.CreateLogger(typeof(DeclarativeAgentExtensions)) ?? NullLogger.Instance;\n        using var declarativeAgentFileJsonContents = DocumentLoader.LoadDocumentFromFilePathAsStream(filePath,\n            logger);\n\n        var results = await DCManifestDocument.LoadAsync(declarativeAgentFileJsonContents, 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 ?? throw new InvalidOperationException(\"Error loading the manifest\");\n        var manifestDirectory = Path.GetDirectoryName(filePath);\n        document.Instructions = await GetEffectiveInstructionsAsync(manifestDirectory, document.Instructions, logger, cancellationToken).ConfigureAwait(false);\n\n        var agent = new T\n        {\n            Name = document.Name,\n            Instructions = document.Instructions,\n            Kernel = kernel,\n            Arguments = new KernelArguments(promptExecutionSettings ?? new PromptExecutionSettings()\n            {\n                FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(),\n            }),\n            Description = document.Description,\n            LoggerFactory = loggerFactory,\n            Id = string.IsNullOrEmpty(document.Id) ? Guid.NewGuid().ToString() : document.Id!,","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.OpenApi.Extensions/Extensions/DeclarativeAgentExtensions.cs#L38-L74","documentation":"Thrown by CreateChatCompletionAgentFromDeclarativeAgentManifestAsync when DCManifestDocument.LoadAsync reports the declarative agent manifest as invalid. Identical mechanism to the plugin-manifest error (601): problems are aggregated into the message string. Applies to the declarative agent YAML/JSON file itself (name, instructions, actions), not the CAP manifests it may reference.","triggerScenarios":"Loading a declarative agent manifest that fails model binding: missing required fields, invalid YAML indentation, unparseable content, or a structure that does not match the declarative-agent schema. ValidationRules are disabled, so this is a structural/deserialization failure.","commonSituations":"YAML indentation errors (tabs vs spaces, inconsistent nesting); a .yaml file where a colon or list marker is misplaced; referencing $[file(...)] instructions with broken syntax; mixing the declarative-agent schema with the plugin-manifest schema.","solutions":["Read the aggregated messages in the exception text - they identify the offending fields.","Run the YAML through a linter to catch indentation/syntax errors before loading.","Confirm the manifest is a declarative agent document (has name/instructions/actions at the top level), not a plugin manifest.","Use a canonical example from the Semantic Kernel or Teams Toolkit docs as a structural template."],"exampleFix":"// before - file is actually a plugin manifest, not a declarative agent\nvar agent = await kernel.CreateChatCompletionAgentFromDeclarativeAgentManifestAsync<ChatCompletionAgent>(\"api-plugin-v2_0.json\");\n\n// after - use the declarative agent YAML\nvar agent = await kernel.CreateChatCompletionAgentFromDeclarativeAgentManifestAsync<ChatCompletionAgent>(\"agent.yaml\");","handlingStrategy":"validation","validationCode":"var text = File.ReadAllText(filePath);\nif (!text.Contains(\"name:\") && !text.Contains(\"\\\"name\\\"\"))\n    throw new InvalidOperationException(\"Declarative agent manifest looks malformed (no name).\");","typeGuard":null,"tryCatchPattern":"try { await kernel.CreateChatCompletionAgentFromDeclarativeAgentManifestAsync<T>(path, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Error loading the manifest\"))\n{ logger.LogError(ex, \"DA manifest invalid: {Msg}\", ex.Message); throw; }","preventionTips":["Lint YAML for indentation before runtime.","Use the declarative-agent schema, not the plugin-manifest schema.","Validate $[file(...)] instruction references resolve."],"tags":["declarative-agent","manifest","validation","yaml"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}