Skip to content

addTag and removeTag operations silently fail — tags not persisted #599

@madshn

Description

@madshn

Bug Description

The addTag and removeTag operations in n8n_update_partial_workflow report success but tags are not actually persisted on the workflow.

Root Cause

Two issues in workflow-diff-engine.js:

  1. Wrong API endpoint: The diff engine modifies workflow.tags in-memory, then sends the updated workflow via PUT /api/v1/workflows/{id}. However, the n8n API ignores the tags field in this endpoint. Tags must be managed via the dedicated PUT /api/v1/workflows/{id}/tags endpoint.

  2. Type mismatch: applyAddTag() pushes a plain string into workflow.tags, but the array contains tag objects ({id, name, createdAt, updatedAt}). Even if the API accepted tags in the workflow PUT, the format would be wrong.

Steps to Reproduce

// 1. Check current tags on a workflow
n8n_get_workflow({ id: "workflow_id", mode: "minimal" })
// Returns: tags: [{ id: "abc", name: "EXISTING_TAG" }]

// 2. Try to add a tag
n8n_update_partial_workflow({
  id: "workflow_id",
  operations: [{ type: "addTag", tag: "NEW_TAG" }]
})
// Returns: success: true, operationsApplied: 1

// 3. Check tags again
n8n_get_workflow({ id: "workflow_id", mode: "minimal" })
// Returns: tags: [{ id: "abc", name: "EXISTING_TAG" }]
// NEW_TAG was NOT added despite reported success

Same behavior for removeTag — reports success but tag remains.

Suggested Fix

addTag and removeTag should make separate API calls to PUT /api/v1/workflows/{id}/tags instead of modifying the workflow payload. This endpoint expects an array of tag objects with id fields:

PUT /api/v1/workflows/{id}/tags
Body: [{"id": "tag-id-1"}, {"id": "tag-id-2"}]

The implementation would need to:

  1. Look up the tag ID by name (via GET /api/v1/tags)
  2. For addTag: merge with existing tag IDs and PUT the full list
  3. For removeTag: filter out the tag ID and PUT the remaining list

Environment

  • n8n-mcp version: 2.35.2
  • n8n version: self-hosted (latest)

Workaround

Use the n8n tags API directly via a separate tool/HTTP call to PUT /api/v1/workflows/{id}/tags.

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