Skip to content

Array query params serialized as comma-separated string instead of key[] format #261

@polaz

Description

@polaz

Bug

buildQueryString() in src/utils/gitlab-api.ts calls String(value) on array parameters, converting ["failed", "success"] to the string "failed,success". GitLab Rails API expects scope[]=failed&scope[]=success.

Impact

Any tool passing array query params to REST API gets 400 Bad Request. Affected:

  • browse_pipelines jobs action (job_scope)
  • browse_pipelines triggers action (trigger_scope)
  • browse_members actions (user_ids)
  • browse_merge_requests list action (approved_by_ids)
  • Any other array params passed through toQuery() -> buildQueryString()

Reproduction

browse_pipelines(action: "jobs", project_id: "123", pipeline_id: "456", job_scope: ["created","pending","running","failed","success","canceled","skipped"])

Returns: 400 Bad Request - scope does not have a valid value

Root Cause

  1. registry.ts: queryOptions.scope = job_scope (array)
  2. toQuery(): passes array through unchanged
  3. buildQueryString(): String(["failed","success"]) -> "failed,success"
  4. URL: ?scope=failed%2Csuccess (invalid)

Fix

  • buildQueryString() handles arrays via searchParams.append(key[], item) (Rails convention)
  • toQuery() return type updated to preserve arrays

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions