# TraconOutputTruncatedException

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.traconoutputtruncatedexception/
> Summary: TraconOutputTruncatedException: Thrown when the model stops at its output token limit before a structured (JSON) response is complete.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

Thrown when the model stops at its output token limit before a structured
(JSON) response is complete.

```csharp
public sealed class TraconOutputTruncatedException : TraconException, ISerializable
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a> ← <a href="/api/tracon.traconexception/">TraconException</a> ← <a href="/api/tracon.traconoutputtruncatedexception/">TraconOutputTruncatedException</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.runtime.serialization.iserializable">ISerializable</a></dd><dt>Inherited Members</dt><dd><a href="/api/tracon.traconexception/#Tracon_TraconException_ErrorType">TraconException.ErrorType</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception">Exception.GetBaseException()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.tostring">Exception.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.gettype">Exception.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.targetsite">Exception.TargetSite</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.message">Exception.Message</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.data">Exception.Data</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.innerexception">Exception.InnerException</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.helplink">Exception.HelpLink</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.source">Exception.Source</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.hresult">Exception.HResult</a>, <a href="https://learn.microsoft.com/dotnet/api/system.exception.stacktrace">Exception.StackTrace</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

The run fails with error type `output_truncated`, classified as
[RunErrorClass.OutputTruncated](/api/tracon.runerrorclass/). A cut-off JSON document cannot be
parsed, and asking the model again with the same limit cuts it off again, so
no structured-response repair turn runs. Raise
[ModelBinding.MaxOutputTokens](/api/tracon.modelbinding/#Tracon_ModelBinding_MaxOutputTokens) instead.

Detection lives in the same shared `IChatClient` decorator that detects a
provider's content filter, so every provider that reports
`ChatFinishReason.Length` gets the same behaviour. A plain-text response
cut off the same way does not throw this exception; its run records a
[RunEventCustomTypes.OutputTruncated](/api/tracon.runeventcustomtypes/#Tracon_RunEventCustomTypes_OutputTruncated) event instead.

The message names the provider and the limit. It never carries the response text.

## Constructors

### <a id="Tracon_TraconOutputTruncatedException__ctor"></a> TraconOutputTruncatedException\(\)

Creates a new error.

```csharp
public TraconOutputTruncatedException()
```

### <a id="Tracon_TraconOutputTruncatedException__ctor_System_String_"></a> TraconOutputTruncatedException\(string\)

Creates a new error.

```csharp
public TraconOutputTruncatedException(string message)
```

#### Parameters

`message` [string](https://learn.microsoft.com/dotnet/api/system.string)

The error message. Must not carry the response text.

### <a id="Tracon_TraconOutputTruncatedException__ctor_System_String_System_Exception_"></a> TraconOutputTruncatedException\(string, Exception\)

Creates a new error.

```csharp
public TraconOutputTruncatedException(string message, Exception innerException)
```

#### Parameters

`message` [string](https://learn.microsoft.com/dotnet/api/system.string)

The error message. Must not carry the response text.

`innerException` [Exception](https://learn.microsoft.com/dotnet/api/system.exception)

The underlying error.

## Fields

### <a id="Tracon_TraconOutputTruncatedException_OutputTruncatedErrorType"></a> OutputTruncatedErrorType

The stable value written to [TraconException.ErrorType](/api/tracon.traconexception/#Tracon_TraconException_ErrorType).

```csharp
public const string OutputTruncatedErrorType = "output_truncated"
```

#### Field Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Properties

### <a id="Tracon_TraconOutputTruncatedException_ErrorType"></a> ErrorType

Gets the stable error type name written to the run record.

```csharp
public override string ErrorType { get; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

#### Remarks

Defaults to the full name of the exception type, so today's behaviour does
not change. A derived type overrides this member when the record has to be
machine readable — for example [TraconContentFilteredException](/api/tracon.traconcontentfilteredexception/)
writes `content_filtered`. Reports and alert rules can rely on this
stable name instead of an assembly name.

The value is written to `RunError.Type` and **carries no secret**.

### <a id="Tracon_TraconOutputTruncatedException_MaxOutputTokens"></a> MaxOutputTokens

Gets the output token limit the request set, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the
binding set none and the provider applied its own default.

```csharp
public int? MaxOutputTokens { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)?

### <a id="Tracon_TraconOutputTruncatedException_ProviderName"></a> ProviderName

Gets the provider whose model stopped at the limit, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when unknown.

```csharp
public string? ProviderName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?
