{"record":{"id":"65aa127a536ddef3","repo":"siyuan-note/siyuan","slug":"config-description-must-not-be-empty","errorCode":null,"errorMessage":"config.description must not be empty","messagePattern":"config\\.description must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/plugin/api_agent.go","lineNumber":93,"sourceCode":"\t\t\t\t\tif name == \"\" {\n\t\t\t\t\t\terr = fmt.Errorf(\"capability name must not be empty\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\terr = fmt.Errorf(\"first argument must be a tool name string\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif c := call.Argument(1); isJsValueNotNull(c) {\n\t\t\t\t\tconfigObj := c.ToObject(rt)\n\t\t\t\t\tif configObj != nil {\n\t\t\t\t\t\tif titleValue := configObj.Get(\"title\"); goja.IsString(titleValue) {\n\t\t\t\t\t\t\ttitle = titleValue.String()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif descriptionValue := configObj.Get(\"description\"); goja.IsString(descriptionValue) {\n\t\t\t\t\t\t\tdescription = strings.TrimSpace(descriptionValue.String())\n\t\t\t\t\t\t\tif description == \"\" {\n\t\t\t\t\t\t\t\terr = fmt.Errorf(\"config.description must not be empty\")\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = fmt.Errorf(\"config.description is required and must be a string\")\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif inputSchemaValue := configObj.Get(\"inputSchema\"); isJsValueNotNull(inputSchemaValue) {\n\t\t\t\t\t\t\tif inputSchema, err = jsCapabilitySchemaToGoSchema(rt, inputSchemaValue); err != nil {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = fmt.Errorf(\"config.inputSchema is required\")\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif outputSchemaValue := configObj.Get(\"outputSchema\"); isJsValueNotNull(outputSchemaValue) {\n\t\t\t\t\t\t\tif outputSchema, err = jsCapabilitySchemaToGoSchema(rt, outputSchemaValue); err != nil {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/plugin/api_agent.go#L75-L111","documentation":"Thrown by siyuan.agent.registerCapability when config.description is a string but trims to empty after strings.TrimSpace. The description is required because it is exposed to the AI model as the tool's purpose — an empty description would make the tool invisible/ambiguous to the model.","triggerScenarios":"Passing config = { description: '', inputSchema: {...} } or config = { description: '   ', inputSchema: {...} } — description is present and is a string, but empty or whitespace-only.","commonSituations":"Plugin developer uses a placeholder empty string intending to fill it later; description is loaded from a config file that has an empty value; copy-paste from a template that left description blank.","solutions":["Provide a meaningful, non-empty description string in the config object","If description is dynamically sourced, validate it is non-empty before calling registerCapability"],"exampleFix":"// before\nawait siyuan.agent.registerCapability('myTool', {\n  description: '',\n  inputSchema: { type: 'object' }\n}, handler);\n\n// after\nawait siyuan.agent.registerCapability('myTool', {\n  description: 'Summarizes the current document',\n  inputSchema: { type: 'object' }\n}, handler);","handlingStrategy":"validation","validationCode":"if (typeof config.description !== 'string' || config.description.trim() === '') {\n  throw new Error('config.description must be a non-empty string');\n}\nawait siyuan.agent.registerCapability(name, config, handler);","typeGuard":"function hasValidDescription(config) {\n  return typeof config?.description === 'string' && config.description.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Write a meaningful description for every capability — it guides the AI model's tool selection","Validate the config object shape before calling registerCapability"],"tags":["plugin","agent","capability","validation","javascript"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}