> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Handling

> Validation errors and recovery strategies

The MCP tools provide detailed error messages designed to help AI agents understand and correct issues.

## Error Format

A failed tool call returns a tool result with `isError: true`. The error is plain text in `content[0].text`, prefixed with `Error: `. There is no structured `code` field. Some errors from `create_content` and `update_content` start with a code such as `NO_PROJECT_CONTEXT:` or `SCHEMA_NOT_FETCHED:` and include `Call:` and `Fix:` lines.

## Project Context Errors

### NO\_PROJECT\_CONTEXT

Returned by `create_content` and `update_content` when no project context is set and no `projectId` parameter is provided.

```json theme={null}
{
  "content": [
    {
      "type": "text",
      "text": "Error: NO_PROJECT_CONTEXT: projectId not set\n\nCall: list_projects({})\n\nFix:\n1) Find your project ID from list_projects results\n2) Either:\n   - Pass projectId directly: create_content({ projectId: \"...\", ... })\n   - Or set default: set_project({ projectId: \"...\" }) then retry"
    }
  ],
  "isError": true
}
```

The search and get tools return `Error: No project context set. Use set_project to set a default project or provide projectId parameter.` instead.

**Recovery**: Call `set_project` with a valid project ID, or include `projectId` in the tool call.

### Project Access Denied

Returned by `set_project` when the user doesn't have access to the specified project.

```json theme={null}
{
  "content": [
    {
      "type": "text",
      "text": "Error: You do not have access to project proj_999"
    }
  ],
  "isError": true
}
```

**Recovery**: Use `list_projects` to find projects you have access to.

## Content Validation Errors

The `create_content` and `update_content` tools validate all content against the content type's JSON schema.

### SCHEMA\_NOT\_FETCHED

Returned by `create_content` and `update_content` when `get_type` has not been called for the content type. Call `get_type` without `typeVersion` to cover every version. Fetched schemas are remembered per user and client for about an hour; after that, call `get_type` again.

```
Error: SCHEMA_NOT_FETCHED: "ct_story_001@latest"

Call: get_type({ contentTypeId: "ct_story_001" })

Fix:
1) Fetch the schema to see required fields and allowed types
2) Then retry create_content with schema-compliant JSON
```

**Recovery**: Call `get_type` for the content type, then retry.

### Schema Validation Failure

When `create_content` or `update_content` sends content that does not match the content type schema, the API rejects it. The error text is the API's message, without the individual validation errors:

```
Error: Content does not match the ContentType schema
```

**Recovery**: Check the content type schema for required fields, field types, and allowed component types.

## Recovery Strategies

When encountering validation errors:

1. **Read the `Call:` and `Fix:` lines**: Coded errors include recovery steps
2. **Review the schema**: Use `get_type` to understand requirements
3. **Fix asset issues**: Use `search_assets` to find valid asset IDs
4. **Handle length constraints**: Split long content into multiple components
5. **Check component types**: Ensure using only allowed component types

## Error Prevention Best Practices

<Steps>
  <Step title="Fetch the schema first">
    Always use `get_type` before creating content to understand the structure and constraints.
  </Step>

  <Step title="Validate asset IDs">
    Use `search_assets` to verify assets exist before referencing them.
  </Step>

  <Step title="Check length limits">
    Review `maxLength` constraints in the schema for all text fields.
  </Step>

  <Step title="Use correct component types">
    Match component type names exactly as defined in the schema's `definitions`.
  </Step>

  <Step title="Include all required fields">
    Check the schema's `required` arrays at each level of the structure.
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.