{"record":{"id":"90a690a275916d2e","repo":"siyuan-note/siyuan","slug":"agent-capability-name-and-description-are-required","errorCode":null,"errorMessage":"Agent capability name and description are required","messagePattern":"Agent capability name and description are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/src/plugin/index.ts","lineNumber":440,"sourceCode":"    }\n\n    public addAgentCapability(options: {\n        name: string,\n        title?: string,\n        description: string,\n        inputSchema: Record<string, unknown>,\n        outputSchema?: Record<string, unknown>,\n        effects?: IAgentCapabilityEffects,\n        actionEffects?: Record<string, IAgentCapabilityEffects>,\n        handler: (args: Record<string, unknown>, app: App) => Promise<{\n            result?: string;\n            structuredContent?: unknown;\n            error?: string;\n        }>\n    }): string {\n        const name = options.name.trim();\n        if (!name || !options.description.trim()) {\n            throw new Error(\"Agent capability name and description are required\");\n        }\n        const id = \"plugin/frontend/\" + encodeURIComponent(this.name) + \"/\" + encodeURIComponent(name);\n        if (!this.agentCapabilities.some((capability) => capability.id === id)) {\n            const generation = registerCapability({\n                id,\n                title: options.title,\n                description: options.description,\n                inputSchema: options.inputSchema,\n                outputSchema: options.outputSchema,\n                effects: options.effects,\n                actionEffects: options.actionEffects,\n                source: \"plugin\",\n                ownerId: this.name,\n                ownerName: this.displayName || this.name,\n                handler: options.handler,\n            });\n            this.agentCapabilities.push({id, generation});\n        }","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/app/src/plugin/index.ts#L422-L458","documentation":"Returned by util.WebFetch when the server-declared Content-Length exceeds the read cap: 5 MiB for text/html and text/plain responses, 10 MiB for any other content type (files/images). The limit protects the kernel from buffering huge responses in memory. Note the check uses resp.ContentLength, so it only fires when the server announces the size up front.","triggerScenarios":"Fetching a page or binary whose Content-Length header exceeds 5/10 MiB, e.g. a large PDF, image, dataset, or generated HTML report, with format handling that expects the body to be saved or converted.","commonSituations":"Pointing the agent web-fetch tool at bulky downloads instead of article pages; sites that serve enormous inline HTML (documentation as single-page apps); attempting to mirror assets through a text-fetch API.","solutions":["Fetch a lighter version of the resource: the plain HTML article page rather than a bundled single-file export, or a lower-resolution asset","Download the large file manually (browser, curl -o) and import it into SiYuan instead of routing it through WebFetch","If you control the deployment and genuinely need bigger fetches, raise maxWebFetchBytes / maxWebFetchFileBytes in kernel/util/webfetch.go and rebuild the kernel","Check for redirect chains that land on an unexpected huge resource (e.g. a CDN error page with a big body)"],"exampleFix":"// before: constants fixed at 5/10 MiB\nmaxWebFetchBytes     = 5 * 1024 * 1024\nmaxWebFetchFileBytes = 10 * 1024 * 1024\n\n// after: raise caps for this deployment, then rebuild the kernel\nmaxWebFetchBytes     = 20 * 1024 * 1024\nmaxWebFetchFileBytes = 50 * 1024 * 1024","handlingStrategy":"fallback","validationCode":"// HEAD request to learn size before the real fetch\nresp, err := http.Head(rawURL)\nif err == nil {\n    if resp.ContentLength > 5*1024*1024 && strings.HasPrefix(resp.Header.Get(\"Content-Type\"), \"text/\") {\n        return errors.New(\"skip: response will exceed WebFetch text limit\")\n    }\n}","typeGuard":"null","tryCatchPattern":"result, err := util.WebFetch(rawURL, format)\nif err != nil && strings.Contains(err.Error(), \"response too large\") {\n    // fall back: ask the user to download manually, or fetch a paginated/lite version\n    result = \"Resource exceeds fetch size limit; download it directly in a browser.\"\n    err = nil\n}","preventionTips":["Do not route large binaries through WebFetch; use direct download + SiYuan import","Prefer article URLs over single-page-app mega-bundles when fetching docs","If large fetches are a steady requirement, size the maxWebFetch* constants for your deployment up front"],"tags":["webfetch","size-limit","content-length","memory"],"backgroundTag":"response-size-limit-exceeded","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}