Skip to content

Bug: Cannot construct a value of type: PlutusTx.Builtins.Internal.BuiltinUnit#7162

Merged
Unisay merged 4 commits intomasterfrom
yura/Cannot-construct-a-value-of-type
Feb 5, 2026
Merged

Bug: Cannot construct a value of type: PlutusTx.Builtins.Internal.BuiltinUnit#7162
Unisay merged 4 commits intomasterfrom
yura/Cannot-construct-a-value-of-type

Conversation

@Unisay
Copy link
Copy Markdown
Contributor

@Unisay Unisay commented Jun 19, 2025

@Unisay Unisay requested a review from SeungheonOh June 19, 2025 14:02
@Unisay Unisay self-assigned this Jun 19, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 19, 2025

PR Preview Action v1.6.3

🚀 View preview at
https://IntersectMBO.github.io/plutus/pr-preview/docs/pr-7162/

Built to branch gh-pages at 2026-02-05 09:00 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 97d926e to 07b20e0 Compare June 19, 2025 14:25
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 07b20e0 to da0e24d Compare July 10, 2025 13:52
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from da0e24d to 9e42a6c Compare July 25, 2025 11:50
@Unisay Unisay requested a review from zliu41 July 25, 2025 16:11
Copy link
Copy Markdown
Collaborator

@SeungheonOh SeungheonOh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer adding special handling for providing better error message instead of disabling simplpass entirely. It seems writing a new simplifier(or rather, unfolder) would require some changes to GHC itself which would be undesirable.

Comment thread doc/notes/plutus-tx-plugin/NO_SIMPLE_PASS.md Outdated
Comment thread doc/notes/plutus-tx-plugin/NO_SIMPLE_PASS.md Outdated
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch 2 times, most recently from f1c28f3 to 81f5a8c Compare February 3, 2026 16:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 3, 2026

Execution Budget Golden Diff

25732e6 (master) vs 7153af2

output

plutus-tx-plugin/test/CallTrace/9.6/successfullEvaluationYieldsNoTraceLog.golden.eval

Metric Old New Δ%
Flat Size 509 343 -32.61%

This comment will get updated when changes are made.

@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 7ed86ac to 7153af2 Compare February 4, 2026 08:49
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 7153af2 to 9b30fe7 Compare February 4, 2026 09:02
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 9b30fe7 to 523d394 Compare February 4, 2026 10:41
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 523d394 to 2e71ed8 Compare February 4, 2026 10:45
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 2e71ed8 to cfb073f Compare February 4, 2026 11:11
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from cfb073f to 72a3af0 Compare February 4, 2026 11:17
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 72a3af0 to e8748f5 Compare February 4, 2026 11:28
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 041e264 to 07882eb Compare February 4, 2026 15:33
@Unisay Unisay marked this pull request as ready for review February 4, 2026 15:34
Comment thread doc/docusaurus/docs/troubleshooting.md Outdated
Add detection of opaque builtin types (BuiltinUnit, BuiltinData, etc.) from PlutusTx.Builtins.Internal and provide actionable guidance when users hit "Cannot construct a value of type" errors.

These errors typically occur when where-bindings inside compile quotations trigger stage violations. The improved messages explain the cause and suggest moving bindings to top-level.
Exercise the improved error messages for various opaque builtin types: BuiltinUnit, BuiltinData, BuiltinByteString, BuiltinString, BuiltinList. Includes positive test for BuiltinInteger (type alias, not opaque).

Uses context-level=0 to avoid package hash mismatches between local and CI builds in golden file output.
Add troubleshooting section explaining why where-bindings inside compile quotations fail with 'Cannot construct a value of type' errors. Provides concrete before/after code examples showing how to move bindings to top-level.
@Unisay Unisay force-pushed the yura/Cannot-construct-a-value-of-type branch from 46d578b to bb27adf Compare February 5, 2026 08:58
@Unisay Unisay enabled auto-merge (squash) February 5, 2026 09:02
@Unisay Unisay merged commit 4c3531f into master Feb 5, 2026
5 of 6 checks passed
@Unisay Unisay deleted the yura/Cannot-construct-a-value-of-type branch February 5, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants