siyuan-note/siyuan · warning

Agent capability name and description are required

Error message

Agent capability name and description are required

What it means

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.

Solutions

  1. Fetch a lighter version of the resource: the plain HTML article page rather than a bundled single-file export, or a lower-resolution asset
  2. Download the large file manually (browser, curl -o) and import it into SiYuan instead of routing it through WebFetch
  3. If you control the deployment and genuinely need bigger fetches, raise maxWebFetchBytes / maxWebFetchFileBytes in kernel/util/webfetch.go and rebuild the kernel
  4. Check for redirect chains that land on an unexpected huge resource (e.g. a CDN error page with a big body)

Example fix

// before: constants fixed at 5/10 MiB
maxWebFetchBytes     = 5 * 1024 * 1024
maxWebFetchFileBytes = 10 * 1024 * 1024

// after: raise caps for this deployment, then rebuild the kernel
maxWebFetchBytes     = 20 * 1024 * 1024
maxWebFetchFileBytes = 50 * 1024 * 1024
Defensive patterns

Strategy: fallback

Validate before calling

// HEAD request to learn size before the real fetch
resp, err := http.Head(rawURL)
if err == nil {
    if resp.ContentLength > 5*1024*1024 && strings.HasPrefix(resp.Header.Get("Content-Type"), "text/") {
        return errors.New("skip: response will exceed WebFetch text limit")
    }
}

Type guard

null

Try / catch

result, err := util.WebFetch(rawURL, format)
if err != nil && strings.Contains(err.Error(), "response too large") {
    // fall back: ask the user to download manually, or fetch a paginated/lite version
    result = "Resource exceeds fetch size limit; download it directly in a browser."
    err = nil
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/90a690a275916d2e. Report an issue: GitHub.

Appendix: source

Thrown at app/src/plugin/index.ts:440

    }

    public addAgentCapability(options: {
        name: string,
        title?: string,
        description: string,
        inputSchema: Record<string, unknown>,
        outputSchema?: Record<string, unknown>,
        effects?: IAgentCapabilityEffects,
        actionEffects?: Record<string, IAgentCapabilityEffects>,
        handler: (args: Record<string, unknown>, app: App) => Promise<{
            result?: string;
            structuredContent?: unknown;
            error?: string;
        }>
    }): string {
        const name = options.name.trim();
        if (!name || !options.description.trim()) {
            throw new Error("Agent capability name and description are required");
        }
        const id = "plugin/frontend/" + encodeURIComponent(this.name) + "/" + encodeURIComponent(name);
        if (!this.agentCapabilities.some((capability) => capability.id === id)) {
            const generation = registerCapability({
                id,
                title: options.title,
                description: options.description,
                inputSchema: options.inputSchema,
                outputSchema: options.outputSchema,
                effects: options.effects,
                actionEffects: options.actionEffects,
                source: "plugin",
                ownerId: this.name,
                ownerName: this.displayName || this.name,
                handler: options.handler,
            });
            this.agentCapabilities.push({id, generation});
        }

View on GitHub (pinned to afa823b6b4)