makeplane / makeplane/plane-python-sdk

WorkItemDetail.labels validation fails when API returns unexpanded label IDs

Open Beginner friendly
#60 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17
Forks
24
Avg merge
8d 9h
Merged PRs (30d)
2

Description

Summary

work_items.retrieve() (and any code path returning a WorkItemDetail) raises a pydantic.ValidationError for any work item that has labels attached, when labels is not explicitly expanded.

Repro

Call the retrieve endpoint for a work item that has one or more labels, without expand=labels:

client.work_items.retrieve(
    workspace_slug=workspace_slug,
    project_id=project_id,
    work_item_id=work_item_id,
)

Result: pydantic.ValidationErrorInput should be a valid dictionary or instance of Label — deterministic, not intermittent, for every work item that has labels.

Root cause

The Plane API returns labels as an array of label ID strings when the field isn't expanded (the normal/default response shape). The WorkItemDetail model types labels as list[Label] unconditionally, so pydantic rejects the plain ID strings instead of accepting either shape.

Expected behavior

labels should accept both shapes depending on whether the caller expanded it — e.g. list[Label] | list[str], or the model should coerce string IDs into a minimal Label reference, consistent with how the API actually behaves when expand isn't requested.

Environment

  • plane-sdk==0.2.19 (PyPI)
  • Found via makeplane/plane-mcp-server (retrieve_work_item / retrieve_work_item_by_identifier tools), but the bug is in the SDK's model, not the MCP server.
  • Server tested against: self-hosted Plane Community 1.3.1.

Workaround in use

Using list_work_items (which doesn't hit this validation path) instead of retrieve_work_item*, and filtering client-side.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Find the WorkItemDetail model in the SDK and reproduce the failure through work_items.retrieve without expand=labels. Verify that labels accepts the API's unexpanded label ID strings as well as expanded Label objects, and confirm the retrieve_work_item paths no longer raise ValidationError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.