lyswhut/lx-music-desktop · error · Error

id or url missing

Error message

id or url missing

What it means

useOpenSonglist in useSonglistAction.js:54 requires at least one identifier — an `id` or a `url` — to open a songlist detail route. After dataVerify produces a sanitized songlistInfo, if both id and url are falsy the handler throws 'id or url missing' rather than routing to an empty detail view.

Solutions

  1. Ensure the deep link includes either an id or a url alongside the source (paths[1] or data.id/data.url).
  2. Validate paths.length >= 2 (or presence of data.id/data.url) before invoking handleOpenSonglist.
  3. Catch the throw at the deeplink router and show a user-facing 'invalid songlist link' dialog.
  4. If url-only links are intended, confirm the url field is being populated from paths[1].

Example fix

// before
    if (!songlistInfo.id && !songlistInfo.url) throw new Error('id or url missing')

// after - guard before calling, and a clearer message
    if (!songlistInfo.id && !songlistInfo.url) {
      throw new Error('id or url missing: provide data.id or data.url (or paths[1]) for source=' + songlistInfo.source)
    }
Defensive patterns

Strategy: validation

Validate before calling

const hasSonglistId = (info) =>
  (info?.id != null && info.id !== '') || (info?.url != null && info.url !== '')
if (!hasSonglistId(info)) {
  showErrorDialog('Songlist link is missing an id or url')
  return
}

Type guard

const hasSonglistId = (info) =>
  Boolean(info) && ((typeof info.id === 'string' || typeof info.id === 'number') || typeof info.url === 'string')

Try / catch

try {
  handleOpenSonglist(info)
} catch (e) {
  errorDialog(e.message)
}

Prevention

When it happens

Trigger: An 'open songlist' deep link supplies a valid source (passes sourceVerify) but neither an id nor a url — e.g. paths has only one segment (the source) and no second element, or the data object omits both keys.

Common situations: A share link template that forgot the list id; path parsing placed the id in the wrong slot; the sender's data payload was constructed without an id/url.

Related errors


AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12). Data as JSON: /api/errors/c3bc0475989911ec. Report an issue: GitHub.

Appendix: source

Thrown at src/renderer/core/useApp/useDeeplink/useSonglistAction.js:54

      id: null,
      url: null,
    }
    if (data) {
      songlistInfo = data
    } else {
      songlistInfo.source = paths[0]
      songlistInfo.url = paths[1]
    }

    sourceVerify(songlistInfo.source)

    songlistInfo = dataVerify([
      { key: 'source', types: ['string'] },
      { key: 'id', types: ['string', 'number'], max: 64 },
      { key: 'url', types: ['string'], max: 500 },
    ], songlistInfo)

    if (!songlistInfo.id && !songlistInfo.url) throw new Error('id or url missing')
    if (isShowPlayerDetail.value) setShowPlayerDetail(false)
    handleOpenSonglist(songlistInfo)
    focusWindow()
  }
}
const usePlaySonglistDetail = () => {
  const playSongListDetail = usePlaySonglist()

  return async({ paths, data }) => {
    let songlistInfo = {
      source: null,
      id: null,
      url: null,
      index: null,
    }
    if (data) {
      songlistInfo = data
    } else {

View on GitHub (pinned to 9c364b482e)