> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sdk-user-guide/_mcp/server.

# holoscan::MetadataPolicy

> Enum to define the policy for handling behavior of MetadataDictionary::set&lt;ValueT&gt;.

Enum to define the policy for handling behavior of [MetadataDictionary::set\<ValueT>](../classes/metadatadictionary#set).

```cpp showLineNumbers={false}
enum class holoscan::MetadataPolicy
```

---

## Values

### kReject

Reject the new value if the key already exists.

### kInplaceUpdate

Replace the `std::any` value within the existing `std::shared_ptr<`[`MetadataObject`](../typedefs/metadataobject)`>` if the key already exists.

### kUpdate

Replace the `std::shared_ptr<`[`MetadataObject`](../typedefs/metadataobject)`>` with a newly constructed one if the key already exists.

### kRaise

Raise an exception if the key already exists.

### kDefault

Default value indicating that the user did not explicitly set a policy via [`Operator::metadata_policy`](../classes/gpuresidentoperator#metadatapolicy).

The policy used will be that set via [`Fragment::metadata_policy`](../classes/fragment#metadatapolicy) if that was set. Otherwise the default of kRaise is used.