langgenius/dify · warning · AgentConfigServiceError

too_many_files

too_many_files

Error message

only one skill file is allowed

What it means

Raised as AgentConfigServiceError (code=too_many_files, HTTP 400) from _read_single_upload: the multipart form-data contained more than one file part. The skill-upload endpoint accepts exactly one file; additional parts are rejected to keep skill processing single-file.

Source

Thrown at api/controllers/console/app/agent_config_inspector.py:464

        user_id=target.account_id,
    )


def _file_list_response(target: _ResolvedConsoleTarget) -> dict[str, object]:
    return _service().list_files(
        tenant_id=target.tenant_id,
        agent_id=target.agent_id,
        config_version_id=target.version_id,
        config_version_kind=target.version_kind,
        user_id=target.account_id,
    )


def _read_single_upload() -> tuple[bytes, str]:
    if "file" not in request.files:
        raise AgentConfigServiceError("no_file", "no skill file uploaded", status_code=400)
    if len(request.files) > 1:
        raise AgentConfigServiceError("too_many_files", "only one skill file is allowed", status_code=400)
    upload = request.files["file"]
    return upload.stream.read(), upload.filename or ""


def _skill_upload_response(target: _ResolvedConsoleTarget) -> tuple[dict[str, object], int]:
    return _upload_skill_for_target(
        tenant_id=target.tenant_id,
        agent_id=target.agent_id,
        user_id=target.account_id,
        version_id=target.version_id,
        version_kind=target.version_kind,
    )


def _upload_skill_for_target(
    *,
    tenant_id: str,
    agent_id: str,

View on GitHub (pinned to ef8544b173)

Solutions

  1. Send exactly one file per request; loop on the client to upload additional files.
  2. If multiple files are needed, call the endpoint once per file sequentially or in bounded parallelism.
  3. Trim any accidental extra file parts before submit.
  4. Update the UI to disable multi-select for this endpoint.

Example fix

// before
files.forEach(f => fd.append('file', f));  // many parts
// after
for (const f of files) { await uploadSingle(f); }  // one per request
Defensive patterns

Strategy: validation

Validate before calling

def ensure_at_most_one_file(request) -> None:
    if len(request.files) > 1:
        raise ValueError('upload only one file per request')

Try / catch

from services.errors.agent_config import AgentConfigServiceError

try:
    client.post(upload_url, files=[('file', f) for f in files])
except AgentConfigServiceError as exc:
    if exc.code == 'too_many_files':
        for f in files:
            client.post(upload_url, files={'file': f})
    raise

Prevention

When it happens

Trigger: POSTing to the agent-config skill upload endpoint with multiple files under 'file' (repeated parts) or with several parts under different keys that all count toward request.files.

Common situations: Client upload component that supports multi-select and submits all selected files in one request; appending the same file twice; a batch helper that wraps a single-file endpoint.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/3f4ee3e527db8220. Report an issue: GitHub.