Skip to content

Unhandled extension hover error #1912

Description

@Pavel-Boyazov

Bug description

copy from prisma/orm#26917

If relation fields doubling and you try hover on doubled field type, VS code extension throws errors in output
First errors (for example, after restart extensions):

prisma-schema-wasm errored with: prisma-schema-wasm errored when invoking hover.
Cannot read properties of undefined (reading 'set_message')

TypeError: Cannot read properties of undefined (reading 'set_message')
    at module.exports.__wbg_setmessage_f22ac4a6869ee695 (/Users/[user]/.vscode/extensions/prisma.prisma-6.16.2/node_modules/@prisma/prisma-schema-wasm/src/prisma_schema_build.js:402:39)
    at prisma_schema_build.wasm.prisma_schema_build::register_panic_hook::{{closure}}::{{closure}}::h221fd41860d62bc2 (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[2161]:0x1d8a33)
    at prisma_schema_build.wasm.std::panicking::rust_panic_with_hook::h4fa3daead9c4e0a7 (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[1612]:0x1c4921)
    at prisma_schema_build.wasm.std::panicking::begin_panic_handler::{{closure}}::hd6c1b2d9392231ac (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[1815]:0x1cdc57)
    at prisma_schema_build.wasm.std::sys::backtrace::__rust_end_short_backtrace::h59d6c402e40a1685 (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[3267]:0x1e8382)
    at prisma_schema_build.wasm.__rustc[5224e6b81cd82a8f]::rust_begin_unwind (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[2857]:0x1e5589)
    at prisma_schema_build.wasm.core::panicking::panic_fmt::hd3052a3662d50c95 (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[2849]:0x1e540e)
    at prisma_schema_build.wasm.core::option::expect_failed::h1a7ece2e267b6691 (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[2207]:0x1d9c5c)
    at prisma_schema_build.wasm.<parser_database::relations::Relations as core::ops::index::Index<parser_database::types::RelationFieldId>>::index::ha914cb110ebd4ccf (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[1407]:0x1b8f9f)
    at prisma_schema_build.wasm.parser_database::walkers::relation_field::<impl parser_database::walkers::Walker<parser_database::types::RelationFieldId>>::opposite_relation_field::h9ad06adee0372bb5 (wasm://wasm/prisma_schema_build.wasm-00b3566a:wasm-function[1676]:0x1c7a60)

Subsequent errors:

[Error - 11:43:52] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot read properties of undefined (reading 'get')
  Code: -32603 

How to reproduce

  1. Create provided schema
  2. Hover on Test2 field type
  3. See first error (if not, restart extensions and try again from 2)
  4. Hover again
  5. See second error

Expected behavior

Expected: Human-read error without switch to output
Actual: Raw error that switches to output

Prisma information

generator client {
  provider        = "prisma-client-js"
}

datasource db {
  provider          = "mysql"
  url               = env("DATABASE_URL")
}

model Test {
  id Boolean @id
  test1 TestArray[]
  test2 TestArray[]
}

model TestArray {
  id Int
  relatedId Boolean
  test String

  relation Test @relation(fields: [relatedId], references: [id])
}

Environment & setup

  • OS: macOS
  • Editor: VS Code
  • Editor version: 1.104.0
  • Extension version:
    6.16.2

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions