Skip to content

Token load fails with t.name.split is not a function error when a token has a non-string name field #3854

@UdayHyma

Description

@UdayHyma

Describe the bug

The plugin fails to load tokens and surfaces the error t.name.split is not a function when a token in the JSON has a name field whose value is not a string (e.g. a number). The whole token load fails with no indication of which token caused the issue. Reported by a customer, reproduced 100% on v2.11.5.

To Reproduce

Steps to reproduce the behavior:

  1. Host the JSON from the "JSON" section below on a public URL (e.g. a public GitHub Gist).
  2. In the plugin, go to Settings → Add new sync → URL.
  3. Paste the raw URL and click Save.
  4. See error: red banner reading t.name.split is not a function. No tokens load.

Expected behavior

Either ignore the non-spec name field on tokens, or surface a clear validation error identifying which token has the bad name value. Currently the token load fails entirely with no diagnostic info.

Screenshots or Screencasts

Image

JSON (optional)

{
  "global": {
    "color": {
      "primary": { "$value": "#ff0000", "$type": "color", "name": 123 }
    }
  },
  "$themes": [],
  "$metadata": {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    📥 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions