zylon-ai/private-gpt · error · ValueError

Unsupported content block type: {type(block)}

Error message

Unsupported content block type: {type(block)}

What it means

Raised by the GET /skills/{skill_id} route when SkillService.get_skill() returns None for the given skill_id and collection. Skills are namespaced per collection; querying an id that does not exist in that specific collection boundary yields this 404.

Source

Thrown at private_gpt/chat/input_models.py:480

                                MessageInput(
                                    role=msg.role,
                                    content=current_blocks,
                                )
                            )
                            current_blocks = []

                        result.append(
                            MessageInput(
                                role="assistant",
                                content=[block],
                            )
                        )
                    elif isinstance(block, ContentBlockType):
                        current_blocks.append(block)
                    elif isinstance(block, str):
                        current_blocks.append(TextBlock(text=block))
                    else:
                        raise ValueError(
                            f"Unsupported content block type: {type(block)}"
                        )

                if current_blocks:
                    result.append(
                        MessageInput(
                            role=msg.role,
                            content=current_blocks,
                        )
                    )
            else:
                result.append(msg)

        return result

    @classmethod
    def _validate_message_order(cls, messages: list[ChatMessage]) -> None:
        """Validates the order of the messages."""

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Verify the skill id exists in the exact collection via the list-skills endpoint for that collection.
  2. Re-fetch the skill list after collection changes and clear stale selections.
  3. Handle 404 by removing the skill from local cache and refreshing.

Example fix

// before
const skill = await skillsApi.get(selectedId, currentCollection);

// after
const skill = await skillsApi.get(selectedId, currentCollection).catch((e) => {
  if (e.status === 404) { cache.remove(selectedId); return null; }
  throw e;
});
Defensive patterns

Strategy: try-catch

Validate before calling

const list = await skillsApi.list(collection);
if (!list.data.some((s) => s.id === skillId)) throw new NotFoundError(skillId);

Try / catch

try { return await skillsApi.get(skillId, collection); }
catch (e) {
  if (e.status === 404) { cache.delete(skillId); return null; }
  throw e;
}

Prevention

When it happens

Trigger: GET /skills/{skill_id}?collection=X where the skill lives in collection Y or was deleted; a freshly created skill read before eventual consistency; typo or URL-encoded id mismatch.

Common situations: Client switches collection context but keeps the previously selected skill id; skill deleted in another session; environment mismatch (dev id used against prod collection); pagination cursor pointing at removed entries.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/ebf70b125968f6cb. Report an issue: GitHub.