Repository navigation
Description
Which @angular/* package(s) are the source of the bug?
common, core
Is this a regression?
Yes
Description
Using a resource as described in
https://angular.dev/guide/signals/resource#reactive-data-fetching-with-httpresource
Expectation
It is possible to overwrite the resource value manually.
Actual Behavior
After the resource entered error state value.set() fails. It is also not possible to manually clear the error state unless doing a reload.
Example:
see the stackblitz attached
How to reproduce
- wait for the stackblitz to load
- now there are two resources, one simulating a successful api call, another one a failing api call
- now click the button to set the values
- value of resource A is now set and state changed to local, but value of resource B is not set, instead there is an exception claiming Resource is currently in an error state
Notes
I am not sure if this is an actual issue or just a documentation issue, but the fact that there is a "local" state and it works before the resource enters error state indicates to me that it is indeed an intended use case for resources to be overridden manually, but there is just documentation or functionality lacking to clear the error state.
The same code worked with angular 19.
Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
[email protected]:26 ERROR ResourceValueError: Resource is currently in an error state (see Error.cause for details): oh no!
at ResourceImpl.computed.equal.equal [as computation] (resource-BPCh38bN.mjs:383:27)
at Object.producerRecomputeValue (signal-ePSl6jXn.mjs:411:33)
at producerUpdateValueVersion (signal-ePSl6jXn.mjs:139:10)
at ResourceImpl.computed2 [as value] (signal-ePSl6jXn.mjs:351:9)
at App_Template (main.ts:26:5)
at executeTemplate (debug_node-Dn-GvQJo.mjs:7142:9)
at refreshView (debug_node-Dn-GvQJo.mjs:8887:13)
at detectChangesInView (debug_node-Dn-GvQJo.mjs:9107:9)
at detectChangesInViewIfAttached (debug_node-Dn-GvQJo.mjs:9067:5)
at detectChangesInComponent (debug_node-Dn-GvQJo.mjs:9055:5)Caused by: Error: oh no!
at main.ts:7:11
at new ZoneAwarePromise (zone.js:2702:25)
at main.ts:6:10
at Generator.next (<anonymous>)
at main.js:41:61
at new ZoneAwarePromise (zone.js:2702:25)
at __async (main.js:25:10)
at mockApiCallFailing (main.ts:5:34)
at Object.loader (main.ts:35:42)
at resource-BPCh38bN.mjs:576:50
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 20.0.0
Node: 20.19.1
Package Manager: npm 10.8.2
OS: linux x64
Angular: 20.0.0
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.2000.0
@angular-devkit/core 20.0.0
@angular-devkit/schematics 20.0.0
@schematics/angular 20.0.0
rxjs 7.8.2
typescript 5.8.2
zone.js 0.15.0
Anything else?
No response
Activity
fix(core): allow to set a resource in an error state
fix(core): allow to set a resource in an error state (#62253)
fix(core): allow to set a resource in an error state (angular#62253)
angular-automatic-lock-bot commentedon Jul 26, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.