Skip to content

tn list command fails with HTTP 400 — uses GET instead of POST #11

Description

@RitchieMatt

When running tn list (or tn projects list), the CLI fails with:

Error: HTTP 400: {"success":false,"error":"For filtering tasks, please use POST /api/tasks/query which supports advanced filtering capabilities. GET /api/tasks is for basic listing only. See API documentation for details."}


Root Cause:

The listTasks() method in lib/api.js constructs a query string and sends a GET request to /api/tasks, but the TaskNotes HTTP API explicitly rejects GET requests to that endpoint and requires POST requests to /api/tasks/query.

Steps to Reproduce:

  1. Configure the CLI with a running TaskNotes API instance
  2. Run tn list
  3. Observe HTTP 400 error

Expected Behavior:

tn list should successfully fetch tasks using the POST /api/tasks/query endpoint.

Actual Behavior:

Command fails with HTTP 400 and error message directing to use POST instead of GET.

Root Issue:

  • lib/api.js has two methods:

    • listTasks(filters) — uses GET (❌ broken)
    • queryTasks(filterQuery) — uses POST (✅ correct)
  • commands/list.js calls api.listTasks() for basic filtering, which sends GET requests.

  • The API no longer supports GET /api/tasks; it requires POST /api/tasks/query.

Solution:

Modify commands/list.js to use api.queryTasks() instead of api.listTasks() when handling both basic and advanced filters. The queryTasks() method already exists and correctly uses POST.

Affected Commands:

  • tn list
  • tn projects list (also uses listTasks())
  • Any other command that calls listTasks()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions