Skip to content

TS Server fatal error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isBindableStaticAccessExpression'. #37633

Closed

Description

@guuzeing

Issue Type: Bug

TypeScript Version: 3.8.3
Steps to reproduce crash
1.
2.
3.
TS Server Error Stack

Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isBindableStaticAccessExpression'.
    at Object.cast (tsserver.js:1371:25)
    at bindSpecialPropertyAssignment (tsserver.js:32562:53)
    at bindWorker (tsserver.js:32114:29)
    at bind (tsserver.js:31991:13)
    at bindExpressionStatement (tsserver.js:31065:13)
    at bindChildrenWorker (tsserver.js:30566:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at tsserver.js:30493:94
    at bindEach (tsserver.js:30509:21)
    at bindEachFunctionsFirst (tsserver.js:30493:13)
    at bindChildrenWorker (tsserver.js:30609:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18411:21)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bindContainer (tsserver.js:30433:17)
    at bind (tsserver.js:32005:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18484:24)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at bindEach (tsserver.js:30509:21)
    at visitNodes (tsserver.js:18286:24)
    at Object.forEachChild (tsserver.js:18474:21)
    at bindEachChild (tsserver.js:30517:16)
    at bindCallExpressionFlow (tsserver.js:31437:21)
    at bindChildrenWorker (tsserver.js:30594:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at doWithConditionalBranches (tsserver.js:30801:13)
    at bindCondition (tsserver.js:30806:13)
    at bindLogicalExpression (tsserver.js:31141:13)
    at bindBinaryExpressionFlow (tsserver.js:31219:33)
    at bindChildrenWorker (tsserver.js:30578:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at bindExpressionStatement (tsserver.js:31065:13)
    at bindChildrenWorker (tsserver.js:30566:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at tsserver.js:30493:94
    at bindEach (tsserver.js:30509:21)
    at bindEachFunctionsFirst (tsserver.js:30493:13)
    at bindChildrenWorker (tsserver.js:30609:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18411:21)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bindContainer (tsserver.js:30433:17)
    at bind (tsserver.js:32005:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18484:24)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18375:21)
    at bindEachChild (tsserver.js:30517:16)
    at bindVariableDeclarationFlow (tsserver.js:31341:13)
    at bindChildrenWorker (tsserver.js:30587:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at bindEach (tsserver.js:30509:21)
    at visitNodes (tsserver.js:18286:24)
    at Object.forEachChild (tsserver.js:18530:24)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18528:21)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at tsserver.js:30493:94
    at bindEach (tsserver.js:30509:21)
    at bindEachFunctionsFirst (tsserver.js:30493:13)
    at bindChildrenWorker (tsserver.js:30609:21)
    at bindChildren (tsserver.js:30487:17)
    at bind (tsserver.js:32002:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18411:21)
    at bindEachChild (tsserver.js:30517:16)
    at bindChildrenWorker (tsserver.js:30612:21)
    at bindChildren (tsserver.js:30487:17)
    at bindContainer (tsserver.js:30433:17)
    at bind (tsserver.js:32005:21)
    at visitNode (tsserver.js:18281:24)
    at Object.forEachChild (tsserver.js:18484:24)

VS Code version: Code 1.43.2 (0ba0ca52957102ca3527cf479571617f0de6ed50, 2020-03-24T07:38:38.248Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz (4 x 3592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 11.92GB (6.30GB free)
Process Argv E:\Projects\dianping\pkg_1112452836_161.wxapkg_dir\app-service.js
Screen Reader no
VM 0%
Extensions (26)
Extension Author (truncated) Version
markdown-preview-github-styles bie 0.1.6
smali cra 1.0.1
arm dan 1.2.0
xml Dot 2.5.0
vscode-great-icons emm 2.1.47
shell-format fox 7.0.1
beautify Hoo 1.5.0
markdown-extended jeb 1.0.16
csharpfixformat Leo 0.0.84
expand-region let 0.1.4
markdown-formatter mer 0.7.9
xml-format mik 1.0.2
vscode-language-pack-zh-hans MS- 1.44.0
csharp ms- 1.21.15
python ms- 2020.3.69010
cpptools ms- 0.26.3
syncing non 3.0.13
java red 0.58.0
vscode-xml red 0.11.0
vscodeintellicode Vis 1.2.6
vscode-java-debug vsc 0.25.1
vscode-java-dependency vsc 0.9.0
vscode-java-pack vsc 0.8.1
vscode-java-test vsc 0.22.2
vscode-maven vsc 0.21.2
clang-format xav 1.9.0

(2 theme extensions excluded)

Activity

  1. deleted a comment from vscodebot on Mar 27, 2020
  2. mjbvz commented on Mar 27, 2020

    @mjbvz

    Seems like the same error+stack mentioned in #34672

  3. removed their assignment
    on Mar 27, 2020
  4. RyanCavanaugh commented on Mar 27, 2020

    @RyanCavanaugh
    Member

    Nathan Shively-Sanders (@sandersn) the referenced bug above claims to have been fixed. Maybe you can try to synthesize a repro for this?

  5. DanielRosenwasser commented on Apr 29, 2020

    @DanielRosenwasser
    Member

    guuze (@guuzeing) can you try out the nightly extension to validate that this is fixed?

  6. sandersn commented on Apr 29, 2020

    @sandersn
    Member

    Ryan Cavanaugh (@RyanCavanaugh) it wasn't necessarily fixed, the repro we had just stopped crashing before we narrowed down the cause. It happened quite a while before this bug was filed, so I don't think they're the same.

  7. sandersn commented on Apr 29, 2020

    @sandersn
    Member

    guuze (@guuzeing), if you find that this isn't fixed, let me know and I can walk you through modifying your tsc.js to print the actual source text instead of [object Object]. That will make reproing this easier.

  8. sandersn commented on Apr 30, 2020

    @sandersn
    Member

    In #34672, looks like we missed the fact that getAssignmentDeclarationKind uses isBindableStaticNameExpression, but the assertion is for isBindableStaticAccessExpression, which has some additional restrictions.

    I'm trying to figure out if those restrictions are proved elsewhere in getAssignmentDeclarationKind, but if they aren't, I should be able to use that to construct a repro.

  9. sandersn commented on Apr 30, 2020

    @sandersn
    Member

    After comparing isBindableStaticNameExpression with isBindableStaticAccessExpression, I think they're equivalent, or that isBindableStaticNameExpression is a superset of isBindableStaticAccessExpression. However, there are lots of possible exceptions since the functions are confusingly interdependent.

    In the meantime, I'm going to fix the assert message to include the declaration text at fault.

  10. RyanCavanaugh commented on May 20, 2020

    @RyanCavanaugh
    Member

    I'm going to close this as "fixed to the best of our knowledge". Without a repro, there's no way of knowing it isn't caused by something else or was handled by one of the referenced PRs.

  11. mohamedaymenkarmous commented on Jul 2, 2020

    @mohamedaymenkarmous

    Hi,

    I have Angular5 project and when I tried to upgrade it to Angular9, I found this issue when I tried to execute ng serve after the upgrade:

    WARNING: This is a simple server for use in testing or debugging Angular applications
    locally. It hasn't been reviewed for security issues.
    
    Binding this server to an open connection can result in compromising your application or
    computer. Using a different host than the one passed to the "--host" flag might result in
    websocket connection issues. You might need to use "--disableHostCheck" if that's the
    case.
    Warning: Entry point 'ng2-date-picker' contains deep imports into '/var/www/MyREDACTEDProject/node_modules/moment/moment'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
    Compiling @angular/animations : module as esm5
    Compiling @angular/core : module as esm5
    Compiling @angular/animations/browser : module as esm5
    Compiling @angular/animations/browser/testing : module as esm5
    Compiling @angular/common : module as esm5
    Compiling @angular/common/http : module as esm5
    Compiling @angular/common/http/testing : module as esm5
    Compiling @angular/core/testing : module as esm5
    Compiling @angular/platform-browser : module as esm5
    Compiling @angular/platform-browser-dynamic : module as esm5
    Compiling @angular/platform-browser/testing : module as esm5
    Compiling @angular/compiler/testing : module as esm5
    Compiling @angular/platform-browser-dynamic/testing : module as esm5
    Compiling @angular/platform-browser/animations : module as esm5
    Compiling @angular/platform-server : module as esm5
    Compiling @angular/platform-server/testing : module as esm5
    Compiling @angular/common/testing : module as esm5
    Compiling @angular/router : module as esm5
    Compiling @angular/router/testing : module as esm5
    Compiling @auth0/angular-jwt : module as esm5
    Compiling @fortawesome/angular-fontawesome : module as esm5
    Compiling @fortawesome/angular-fontawesome/testing : module as esm5
    Compiling @handsontable/angular : module as esm5
    Compiling @angular/forms : module as esm5
    Compiling @ng-bootstrap/ng-bootstrap : module as esm5
    Compiling @nguniversal/common : module as esm5
    Compiling @nguniversal/common/engine : module as esm5
    Compiling @nguniversal/common/tokens : module as esm5
    Compiling @nguniversal/express-engine/tokens : module as esm5
    Compiling @nguniversal/express-engine : module as esm5
    Compiling angular-recaptcha3 : module as esm5
    Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isBindableStaticAccessExpression'.
        at Object.cast (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:1488:25)
        at bindSpecialPropertyAssignment (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:31602:53)
        at bindWorker (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:31166:29)
        at bind (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:31045:13)
        at bindExpressionStatement (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:30249:13)
        at bindChildrenWorker (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:29711:21)
        at bindChildren (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:29632:17)
        at bind (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:31056:21)
        at /var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:29638:94
        at bindEach (/var/www/MyREDACTEDProject/node_modules/typescript/lib/typescript.js:29654:21)
    An unhandled exception occurred: NGCC failed.
    See "/tmp/ng-nefAL3/angular-errors.log" for further details.
    

    And it was annoying since I wasn't able to make it disappear with Typescript 3.9 nor with Typescript 3.83 and since I'm sure the project was working fine with an older version of Typescript, I tried to downgrade the version of Typescript between 3.6 and 3.9 as recommended and this issue was fixed when I downgraded Typescript from 3.8 to 3.6. But I tried to test if the version 3.7 (3.7.5) will also keep doing the job or not and I found that it did very well

    This is the output of npm outdated --allow-dirty after I fixed the issue:

    Package                               Current      Wanted    Latest  Location
    @angular-devkit/build-angular         0.901.9    0.901.10  0.1000.1  angular-latest
    @angular/animations                    9.1.11      9.1.11    10.0.2  angular-latest
    @angular/cli                            9.1.9      9.1.10    10.0.1  angular-latest
    @angular/common                        9.1.11      9.1.11    10.0.2  angular-latest
    @angular/compiler                      9.1.11      9.1.11    10.0.2  angular-latest
    @angular/compiler-cli                  9.1.11      9.1.11    10.0.2  angular-latest
    @angular/core                          9.1.11      9.1.11    10.0.2  angular-latest
    @angular/forms                         9.1.11      9.1.11    10.0.2  angular-latest
    @angular/language-service              7.2.16      7.2.16    10.0.2  angular-latest
    @angular/localize                      9.1.11      9.1.11    10.0.2  angular-latest
    @angular/platform-browser              9.1.11      9.1.11    10.0.2  angular-latest
    @angular/platform-browser-dynamic      9.1.11      9.1.11    10.0.2  angular-latest
    @angular/platform-server               9.1.11      9.1.11    10.0.2  angular-latest
    @angular/router                        9.1.11      9.1.11    10.0.2  angular-latest
    @auth0/angular-jwt                      2.1.2       2.1.2     4.2.0  angular-latest
    @nguniversal/express-engine             9.1.1       9.1.1    10.0.1  angular-latest
    @sentry/browser                        5.18.1      5.19.0    5.19.0  angular-latest
    @types/node                          10.17.26    10.17.26   14.0.14  angular-latest
    @yaireo/tagify                         2.31.6      2.31.6    3.13.0  angular-latest
    angular-recaptcha3                 0.2.0-beta  0.2.0-beta     0.1.2  angular-latest
    core-js                                2.6.11      2.6.11     3.6.5  angular-latest
    jasmine-spec-reporter                   4.2.1       4.2.1     5.0.2  angular-latest
    karma-chrome-launcher                   2.2.0       2.2.0     3.1.0  angular-latest
    karma-coverage-istanbul-reporter        2.1.1       2.1.1     3.0.3  angular-latest
    karma-jasmine                           2.0.1       2.0.1     3.3.1  angular-latest
    ng-dynamic-component                    6.1.0       6.1.0     7.0.1  angular-latest
    ngx-loading                             3.0.1       3.0.1     8.0.0  angular-latest
    rxjs                                    6.5.5       6.6.0     6.6.0  angular-latest
    rxjs-compat                             6.5.5       6.6.0     6.6.0  angular-latest
    ts-node                                 7.0.1       7.0.1    8.10.2  angular-latest
    tslib                                  1.13.0      1.13.0     2.0.0  angular-latest
    tslint                                 5.20.1      5.20.1     6.1.2  angular-latest
    typescript                              3.7.5       3.9.6     3.9.6  angular-latest
    
    npm -v
    6.14.5
    ng v
    ...
    Angular CLI: 9.1.9
    Node: 10.16.0
    OS: linux x64
    ...
    

    Now when I tried to deploy again the project in a new folder, I get surprised with this issue again after executing ng serve. And then, I figured out maybe that this issue was fixed after downgrading Typescript to the version 3.6 directly and not with the version 3.7

    So I wanted to check if this is correct by executing:

    npm install [email protected]
    ng serve
    

    And the error was gone

    This is the output of the new npm outdated --allow-dirty:

    Package                               Current      Wanted    Latest  Location
    @angular-devkit/build-angular         0.901.9    0.901.10  0.1000.1  angular-latest
    @angular/animations                    9.1.11      9.1.11    10.0.2  angular-latest
    @angular/cli                            9.1.9      9.1.10    10.0.1  angular-latest
    @angular/common                        9.1.11      9.1.11    10.0.2  angular-latest
    @angular/compiler                      9.1.11      9.1.11    10.0.2  angular-latest
    @angular/compiler-cli                  9.1.11      9.1.11    10.0.2  angular-latest
    @angular/core                          9.1.11      9.1.11    10.0.2  angular-latest
    @angular/forms                         9.1.11      9.1.11    10.0.2  angular-latest
    @angular/language-service              7.2.16      7.2.16    10.0.2  angular-latest
    @angular/localize                      9.1.11      9.1.11    10.0.2  angular-latest
    @angular/platform-browser              9.1.11      9.1.11    10.0.2  angular-latest
    @angular/platform-browser-dynamic      9.1.11      9.1.11    10.0.2  angular-latest
    @angular/platform-server               9.1.11      9.1.11    10.0.2  angular-latest
    @angular/router                        9.1.11      9.1.11    10.0.2  angular-latest
    @auth0/angular-jwt                      2.1.2       2.1.2     4.2.0  angular-latest
    @nguniversal/express-engine             9.1.1       9.1.1    10.0.1  angular-latest
    @sentry/browser                        5.18.1      5.19.0    5.19.0  angular-latest
    @types/node                          10.17.26    10.17.26   14.0.14  angular-latest
    @yaireo/tagify                         2.31.6      2.31.6    3.13.0  angular-latest
    angular-recaptcha3                 0.2.0-beta  0.2.0-beta     0.1.2  angular-latest
    core-js                                2.6.11      2.6.11     3.6.5  angular-latest
    jasmine-spec-reporter                   4.2.1       4.2.1     5.0.2  angular-latest
    karma-chrome-launcher                   2.2.0       2.2.0     3.1.0  angular-latest
    karma-coverage-istanbul-reporter        2.1.1       2.1.1     3.0.3  angular-latest
    karma-jasmine                           2.0.1       2.0.1     3.3.1  angular-latest
    ng-dynamic-component                    6.1.0       6.1.0     7.0.1  angular-latest
    ngx-loading                             3.0.1       3.0.1     8.0.0  angular-latest
    rxjs                                    6.5.5       6.6.0     6.6.0  angular-latest
    rxjs-compat                             6.5.5       6.6.0     6.6.0  angular-latest
    ts-node                                 7.0.1       7.0.1    8.10.2  angular-latest
    tslib                                  1.13.0      1.13.0     2.0.0  angular-latest
    tslint                                 5.20.1      5.20.1     6.1.2  angular-latest
    typescript                              3.6.5       3.9.6     3.9.6  angular-latest
    

    Maybe the installation of Typescript 3.6 comes with specific dependencies that fixed the issue and those dependencies were still there even after upgrading Typescript to 3.7. I can't figure out what are these dependencies that makes this issue disappear since the only difference that we can figure out in the output of npm outdated --allow-dirty is the Typescript version

    So this is how I fixed this issue and I wanted to share this with you.

    I hope this could be helpful

  12. DanielRosenwasser commented on Jul 2, 2020

    @DanielRosenwasser
    Member

    Do you get the exact same stack trace in 3.9.6? Nathan Shively-Sanders (@sandersn) did some work to improve the message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Needs More InfoThe issue still hasn't been fully clarifiedVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions