Skip to content

[BUG] #40

Description

@nkissick-del

Describe the bug

TaskService.getAllTasks() calls /tasks/all, which does not exist in Vikunja v2.x. The Vikunja API returns error code 2004 ("Invalid model provided: Bad Request"). The correct endpoint for listing all tasks across projects in Vikunja v2.x is /tasks.

To Reproduce

  1. Initialize client with a Vikunja v2.3.0 instance URL and a valid API token
  2. Call client.tasks.getAllTasks()
  3. Pass any parameters (e.g. { per_page: 1 })
  4. See error: {"code":2004,"message":"Invalid model provided: Bad Request"}

Confirmed by testing the endpoints directly with curl:

# Fails — endpoint does not exist in Vikunja v2.3.0
curl -H "Authorization: Bearer $TOKEN" "https://vikunja.example.com/api/v1/tasks/all?per_page=1"
# => {"code":2004,"message":"Invalid model provided: Bad Request"}

# Works — correct endpoint
curl -H "Authorization: Bearer $TOKEN" "https://vikunja.example.com/api/v1/tasks?per_page=1"
# => [ { "id": 2, "title": "...", ... } ]

Expected behavior

getAllTasks() should return a list of tasks across all projects, using the /tasks endpoint that exists in Vikunja v2.x.

Code Example

import { VikunjaClient } from 'node-vikunja';

const client = new VikunjaClient('https://vikunja.example.com/api/v1', 'tk_your_api_token');
const tasks = await client.tasks.getAllTasks({ per_page: 1 });
// Throws: "Invalid model provided: Bad Request"

Environment (please complete the following information):

  • Node.js version: 20.19.2
  • Package version: node-vikunja 0.4.0 (via @democratize-technology/vikunja-mcp 0.2.0)
  • Vikunja version: 2.3.0

Additional context

The fix is a one-line change in src/services/task.service.ts — the getAllTasks method should request /tasks instead of /tasks/all:

- return this.request('/tasks/all', 'GET', undefined, {
+ return this.request('/tasks', 'GET', undefined, {

I've verified this fix works by patching the compiled JS in dist/esm/services/task.service.js. After the change, getAllTasks() returns tasks correctly.

This may be a regression from an older Vikunja API version that used /tasks/all, or the endpoint may never have existed — either way, Vikunja v2.x does not serve it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions