mapbox / mapbox/mapbox-gl-js

`Failed to evaluate expression` warning when using mouse events

Open
#13,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 3.7.0
**browser**: Chrome 130.0.6723.92 (64-bit)

### Steps to Trigger Behavior

1. Define a symbol layer with `text-field` combining `at` and `get` operators
2. Add a mouse event listener for the applicable layer
3. Hover a point in the applicable layer
4. Observe that a console warning is emitted

### Link to Demonstration
https://jsfiddle.net/pkhalle/9o18f52s/

### Expected Behavior
No console warning is emitted.

### Actual Behavior
The following console warning is emitted:

```
Failed to evaluate expression "["format",["get","value",["at",0,["array",["get","texts"]]]],{}]". The expression ["get","texts"] evaluated to string but was expected to be of type array.
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked JSFiddle and reproduce the warning using a symbol layer whose text-field combines at and get, then trace the mouse event listener path and expression evaluation. Done means hovering the applicable layer no longer emits the type-mismatch warning while the text expression still evaluates correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.