# PackageDescription.Context.environment crash when evaluating Package.swift

**URL:** https://community.tuist.dev/t/packagedescription-context-environment-crash-when-evaluating-package-swift/980
**Category:** Troubleshooting & how to
**Created:** [May 5, 2026, 12:44pm UTC](https://community.tuist.dev/t/packagedescription-context-environment-crash-when-evaluating-package-swift/980 "2026-05-05T12:44:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Kyle-Ye](https://community.tuist.dev/user_avatar/community.tuist.dev/kyle-ye/32/836_2.png) [@Kyle-Ye](https://community.tuist.dev/u/Kyle-Ye)
#### Post date: [May 5, 2026, 12:44pm UTC](https://community.tuist.dev/t/packagedescription-context-environment-crash-when-evaluating-package-swift/980/1 "2026-05-05T12:44:22Z")

</div>

# Question or problem

Hi @pepicrft, I opened [tuist/tuist#10616](https://github.com/tuist/tuist/issues/10616) and wanted to check whether this is behavior Tuist is expected to support.

When Tuist evaluates a `Package.swift`, accessing `PackageDescription.Context.environment` crashes manifest evaluation:

```swift
let demoContextValue = Context.environment["DEMO_CONTEXT_VALUE"]

```

The crash is:

```plaintext
PackageDescription/Context.swift:19: Fatal error:
'try!' expression unexpectedly raised an error:
Could not decode ContextModel parameter.

```

My current understanding is that `PackageDescription.Context.environment` depends on `ContextModel.decode()`, which expects a `-context` argument in `ProcessInfo.processInfo.arguments`. SwiftPM appends that `-context` argument when it evaluates a manifest, but the Tuist manifest evaluation command shown in the error does not include it.

# Expectation

I expected this to behave like SwiftPM’s manifest evaluation, where `Context.environment` can be read successfully. If Tuist intentionally does not support `PackageDescription.Context` APIs in package manifests, then a clearer diagnostic or documentation note would also make sense.

# Context

- GitHub issue: [PackageDescription.Context.environment crashes when Tuist evaluates Package.swift · Issue #10616 · tuist/tuist · GitHub](https://github.com/tuist/tuist/issues/10616)
- Tuist version: 4.174.2
- macOS: 15.7.4
- Xcode: 26.3

# Reproduction

The issue includes a small `DemoKit` sample. The minimal trigger is a top-level `Package.swift` access to `Context.environment`.

Tuist crashes:

```sh
DEMO_CONTEXT_VALUE=hello tuist generate --no-open

```

SwiftPM can evaluate the same manifest successfully:

```sh
DEMO_CONTEXT_VALUE=hello swift package dump-package

```

Could you confirm whether Tuist is expected to support this `PackageDescription.Context` behavior when evaluating `Package.swift`? If yes, I would be happy to submit a PR to fix it.
