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

# Get LCA Calculation Errors

> List data problems that silently distort an LCA's calculated results, grouped by canvas block

# Get LCA Calculation Errors

List every data problem that distorts the calculated results of an LCA without failing the calculation. Pieces without a linked activity or emission factor contribute 0 to every category, and pieces with incomplete unit conversions are dropped entirely — this endpoint surfaces those silent omissions, attributed to the canvas block they live in, so they can be fixed.

## Request

### Path Parameters

<ParamField path="lca_id" type="uuid" required>
  The UUID of the LCA portfolio

  **Example:** `a1b2c3d4-e5f6-7890-abcd-ef1234567890`
</ParamField>

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Query Parameters

<ParamField query="block_id" type="uuid">
  Filter the items to a single canvas block.

  **Example:** `e5f6a7b8-c9d0-1234-ef01-567890123456`
</ParamField>

## Response

<ResponseField name="items" type="array[object]">
  One item per (error code, canvas block) combination

  <Expandable title="Calculation Error Item">
    <ResponseField name="code" type="string">
      Machine-readable error code:

      * `missing_emission_factor` — piece has no emission factor associated
      * `invalid_conversions` — piece has incomplete unit conversions
      * `pending_distances` — distribution distances are still being calculated
      * `distribution_route_errors` — distribution routes failed and cannot be calculated
      * `circular_reference` — blocks form a circular connection and cannot be calculated
      * `relation_in_multiple_blocks` — a material instance is listed in more than one material block; its impact is attributed to only one of them
    </ResponseField>

    <ResponseField name="detail" type="string">Human-readable explanation</ResponseField>
    <ResponseField name="block_id" type="string | null">Canvas block the error is attributed to (`null` when not attributable to a single block)</ResponseField>
    <ResponseField name="block_name" type="string | null">Block display name</ResponseField>

    <ResponseField name="pieces" type="array[object]">
      Affected pieces (empty for block-level errors)

      <Expandable title="Piece Object">
        <ResponseField name="piece_id" type="string | null">Piece UUID</ResponseField>
        <ResponseField name="piece_name" type="string | null">Piece display name</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/lca/portfolio/a1b2c3d4-e5f6-7890-abcd-ef1234567890/calculation-errors" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  headers = {
      "x-api-key": os.getenv("DCYCLE_API_KEY"),
      "x-organization-id": os.getenv("DCYCLE_ORG_ID")
  }

  lca_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  response = requests.get(
      f"https://api.dcycle.io/lca/portfolio/{lca_id}/calculation-errors",
      headers=headers,
  )

  for item in response.json()["items"]:
      block = item["block_name"] or "LCA-wide"
      print(f"[{item['code']}] {block}: {item['detail']}")
      for piece in item["pieces"]:
          print(f"  - {piece['piece_name']}")
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [
    {
      "code": "missing_emission_factor",
      "detail": "Piece is linked to an activity without emission factors for its region and methodology, so it counts as 0 in every category.",
      "block_id": "e5f6a7b8-c9d0-1234-ef01-567890123456",
      "block_name": "Raw materials",
      "pieces": [
        {
          "piece_id": "b8c9d0e1-f2a3-4567-1234-890123456789",
          "piece_name": "Recycled aluminium"
        }
      ]
    },
    {
      "code": "invalid_conversions",
      "detail": "Piece has incomplete unit conversions, so it is silently dropped from the calculation.",
      "block_id": "e5f6a7b8-c9d0-1234-ef01-567890123456",
      "block_name": "Raw materials",
      "pieces": [
        {
          "piece_id": "c9d0e1f2-a3b4-5678-2345-901234567890",
          "piece_name": "Cardboard box"
        }
      ]
    }
  ]
}
```

An empty `items` array means no data problems were detected.

## Common Errors

### 404 Not Found

**Cause:** LCA does not exist or does not belong to the specified organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "code": "NOT_FOUND",
  "detail": "LCA not found"
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get LCA Dashboard" icon="chart-column" href="/api-reference/lca/dashboard">
    Calculated impact results by life cycle stage
  </Card>

  <Card title="LCA Overview" icon="leaf" href="/api-reference/lca/overview">
    LCA API introduction and concepts
  </Card>
</CardGroup>
