Skip to content

NG0600: Writing to signals is not allowed in a computed from viewChildren() signal #63291

@Licen-it

Description

@Licen-it

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

I'm getting the following stackstrace:

ERROR RuntimeError: NG0600: Writing to signals is not allowed in a `computed`.
    at core.mjs:22722:11
    at throwInvalidWriteToSignalError (untracked-BKcld_ew.mjs:410:3)
    at signalUpdateFn (untracked-BKcld_ew.mjs:455:5)
    at signalFn.update (core.mjs:6833:33)
    at QueryList._onDirty (core.mjs:18458:52)
    at QueryList.setDirty (core.mjs:6998:10)
    at _LQuery_.setDirty (core.mjs:18007:20)
    at _LQueries_.dirtyQueriesWithMatches (core.mjs:18045:25)
    at _LQueries_.insertView (core.mjs:18034:10)
    at insertView (core.mjs:14125:14)

Which is failing on a setTimeout that nothing has to do with signals in my code. Debugging a bit and removing code around I narrowed it down to the usage of veiewChildren() singal to gather components rendered inside a table cell (to be more precise inside a Carbon Components Angular table cell). If I use this outside of the table I don't get the error. If I use @ViewChildren and then toSignal() on the changes observable I don't get this error.
Initially I thought it was a problem of the angular version i was using (v18), but now that i upgraded to v19 i can still reproduce the issue. I also debugged the Carbon code to see if there was something strange happening there, but there is nothing special there.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

ERROR RuntimeError: NG0600: Writing to signals is not allowed in a `computed`.
    at core.mjs:22722:11
    at throwInvalidWriteToSignalError (untracked-BKcld_ew.mjs:410:3)
    at signalUpdateFn (untracked-BKcld_ew.mjs:455:5)
    at signalFn.update (core.mjs:6833:33)
    at QueryList._onDirty (core.mjs:18458:52)
    at QueryList.setDirty (core.mjs:6998:10)
    at _LQuery_.setDirty (core.mjs:18007:20)
    at _LQueries_.dirtyQueriesWithMatches (core.mjs:18045:25)
    at _LQueries_.insertView (core.mjs:18034:10)
    at insertView (core.mjs:14125:14)

Please provide the environment you discovered this bug in (run ng version)

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 19.2.15
Node: 24.1.0 (Unsupported)
Package Manager: pnpm 10.5.2
OS: darwin arm64

Angular: 19.2.14
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker

Package                              Version
--------------------------------------------------------------
@angular-devkit/architect            0.1902.15 (cli-only)
@angular-devkit/build-angular        19.2.15
@angular-devkit/core                 19.2.15 (cli-only)
@angular-devkit/schematics           19.2.15 (cli-only)
@angular/cdk                         19.2.19
@angular/cli                         19.2.15
@angular/material                    19.2.19
@angular/material-date-fns-adapter   19.2.19
@schematics/angular                  19.2.15 (cli-only)
rxjs                                 7.8.2
typescript                           5.5.4
zone.js                              0.15.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: reactivityWork related to fine-grained reactivity in the core frameworkneeds reproductionThis issue needs a reproduction in order for the team to investigate further

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions