Tomato6966 / lavalink-client

Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.
https://tomato6966.github.io/lavalink-client/
MIT License
48 stars 13 forks source link

err_invalid_char #16

Closed nightnai35p closed 9 months ago

nightnai35p commented 10 months ago

TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Client-Name"] at ClientRequest.setHeader (node:_http_outgoing:579:3) at new ClientRequest (node:_http_client:256:14) at request (node:http:96:10) at initAsClient (G:\Discord Bots\wzsy\node_modules\ws\lib\websocket.js:851:28) at new WebSocket (G:\Discord Bots\wzsy\node_modules\ws\lib\websocket.js:85:7) at LavalinkNode.connect (G:\Discord Bots\wzsy\node_modules\lavalink-client\dist\cjs\structures\Node.js:206:23) at LavalinkManager.init (G:\Discord Bots\wzsy\node_modules\lavalink-client\dist\cjs\structures\LavalinkManager.js:149:28) at Client.<anonymous> (G:\Discord Bots\wzsy\src\index.js:50:20) at Client.emit (node:events:390:28) at WebSocketManager.triggerClientReady (G:\Discord Bots\wzsy\node_modules\discord.js\src\client\websocket\WebSocketManager.js:388:17) { code: 'ERR_INVALID_CHAR' }

Tomato6966 commented 10 months ago

Can you show me your LavalinkManager.init() Function / what you put in the ManagerOption#client property?

nightnai35p commented 10 months ago

client.user

Tomato6966 commented 10 months ago

Can you show it to me, i asume that client.user.username has characters which are not useable in a header Make sure that your client.username does not have special chars which are not sendable.

nightnai35p commented 10 months ago

client username?

nightnai35p commented 10 months ago

oh cant use chinese invalid_char solved But another error arises err_unhandled_error

Tomato6966 commented 10 months ago

can you show the error?

Tomato6966 commented 10 months ago

and again, if possible the code related to it.

nightnai35p commented 10 months ago

`node:events:381 throw err; // Unhandled 'error' event ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (<ref 1> LavalinkNode { options: { secure: false, retryAmount: 5, retryDelay: 30000, requestTimeout: 10000, host: 'localhost', port: 2333, authorization: 'Miko-20180305', regions: [] }, calls: 0, stats: { players: 0, playingPlayers: 0, cpu: { cores: 0, lavalinkLoad: 0, systemLoad: 0 }, memory: { allocated: 0, free: 0, reservable: 0, used: 0 }, uptime: 0, frameStats: { deficit: 0, nulled: 0, sent: 0 } }, sessionId: null, info: null, NodeManager: <ref 2> NodeManager { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, nodes: MiniMap(1) [Map] { 'localhost:2333' => [Circular 1] }, LavalinkManager: LavalinkManager { _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, initiated: true, players: MiniMap(0) [Map] {}, utils: [ManagerUtils], options: [Object], nodeManager: [Circular 2],

},
[Symbol(kCapture)]: false

}, reconnectTimeout: undefined, reconnectAttempts: 1, socket: WebSocket { _events: [Object: null prototype] { open: [Function: bound open] AsyncFunction, close: [Function (anonymous)], message: [Function: bound message] AsyncFunction, error: [Function: bound error] }, _eventsCount: 4, _maxListeners: undefined, _binaryType: 'nodebuffer', _closeCode: 1006, _closeFrameReceived: false, _closeFrameSent: false, _closeMessage: , _closeTimer: null, _extensions: {}, _paused: false, _protocol: '', _readyState: 2, _receiver: null, _sender: null, _socket: null, _bufferedAmount: 0, _isServer: false, _redirects: 0, _url: 'ws://localhost:2333/v4/websocket', _req: null,

}, rest: <ref *3> Pool { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined,

[Symbol(destroyed)]: false,
[Symbol(onDestroyed)]: null,
[Symbol(closed)]: false,
[Symbol(onClosed)]: [],
[Symbol(queue)]: FixedQueue {
  tail: [FixedCircularBuffer],
  head: [FixedCircularBuffer]
},
[Symbol(clients)]: [],
[Symbol(queued)]: 0,
[Symbol(onDrain)]: [Function: onDrain],
[Symbol(onConnect)]: [Function (anonymous)],
[Symbol(onDisconnect)]: [Function (anonymous)],
[Symbol(onConnectionError)]: [Function (anonymous)],
[Symbol(stats)]: PoolStats { [Symbol(pool)]: [Circular *3] },
[Symbol(dispatch interceptors)]: [],
[Symbol(connections)]: null,
[Symbol(url)]: URL {
  href: 'http://localhost:2333/',
  origin: 'http://localhost:2333',
  protocol: 'http:',
  username: '',
  password: '',
  host: 'localhost:2333',
  hostname: 'localhost',
  port: '2333',
  pathname: '/',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
},
[Symbol(options)]: {
  connect: [Function: connect],
  allowH2: undefined,
  interceptors: undefined
},
[Symbol(factory)]: [Function: defaultFactory]

}, version: 'v4', decode: { singleTrack: [AsyncFunction: singleTrack], multipleTracks: [AsyncFunction: multipleTracks] }, routePlannerApi: { getStatus: [AsyncFunction: getStatus], unmarkFailedAddress: [AsyncFunction: unmarkFailedAddress], unmarkAllFailedAddresses: [AsyncFunction: unmarkAllFailedAddresses] } }) at new NodeError (node:internal/errors:371:5) at NodeManager.emit (node:events:379:17) at LavalinkNode.error (G:\Discord Bots\wzsy\node_modules\lavalink-client\dist\cjs\structures\Node.js:498:26) at WebSocket.emit (node:events:390:28) at emitErrorAndClose (G:\Discord Bots\wzsy\node_modules\ws\lib\websocket.js:1016:13) at ClientRequest. (G:\Discord Bots\wzsy\node_modules\ws\lib\websocket.js:864:5) at ClientRequest.emit (node:events:390:28) at Socket.socketErrorListener (node:_http_client:447:9) at Socket.emit (node:events:390:28) at emitErrorNT (node:internal/streams/destroy:157:8) { code: 'ERR_UNHANDLED_ERROR', context: <ref 1> LavalinkNode { options: { secure: false, retryAmount: 5, retryDelay: 30000, requestTimeout: 10000, host: 'localhost', port: 2333, authorization: 'Miko-20180305', regions: [] }, calls: 0, stats: { players: 0, playingPlayers: 0, cpu: { cores: 0, lavalinkLoad: 0, systemLoad: 0 }, memory: { allocated: 0, free: 0, reservable: 0, used: 0 }, uptime: 0, frameStats: { deficit: 0, nulled: 0, sent: 0 } }, sessionId: null, info: null, NodeManager: <ref 3> NodeManager { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, nodes: MiniMap(1) [Map] { 'localhost:2333' => [Circular 1] }, LavalinkManager: <ref 2> LavalinkManager { _events: [Object: null prototype] { nodeConnect: [Function (anonymous)], nodeError: [Function (anonymous)], trackStart: [Function (anonymous)] }, _eventsCount: 3, _maxListeners: undefined, initiated: true, players: MiniMap(0) [Map] {}, utils: ManagerUtils { LavalinkManager: [Circular 2] }, options: { client: { id: '1173256848699306037', username: 'wzsy', bot: true, system: false, flags: [UserFlagsBitField], globalName: null, discriminator: '2240', avatar: '541a373e434cebe790ea25cf087c82d4', banner: undefined, accentColor: undefined, avatarDecoration: null, verified: true, mfaEnabled: true }, sendToShard: [Function: sendToShard], nodes: [ [Object] ], playerOptions: { applyVolumeAsFilter: false, clientBasedPositionUpdateInterval: 100, defaultSearchPlatform: 'ytsearch', onDisconnect: [Object], onEmptyQueue: [Object], volumeDecrementer: 1, requesterTransformer: null, useUnresolvedData: false }, linksWhitelist: [], linksBlacklist: [], autoSkip: true, emitNewSongsOnly: false, queueOptions: { maxPreviousTracks: 50, queueChangesWatcher: null, queueStore: [DefaultQueueStore] }, advancedOptions: { debugOptions: [Object] } }, nodeManager: [Circular 3],

  },
  [Symbol(kCapture)]: false
},
reconnectTimeout: undefined,
reconnectAttempts: 1,
socket: WebSocket {
  _events: [Object: null prototype] {
    open: [Function: bound open] AsyncFunction,
    close: [Function (anonymous)],
    message: [Function: bound message] AsyncFunction,
    error: [Function: bound error]
  },
  _eventsCount: 4,
  _maxListeners: undefined,
  _binaryType: 'nodebuffer',
  _closeCode: 1006,
  _closeFrameReceived: false,
  _closeFrameSent: false,
  _closeMessage: Buffer(0) [Uint8Array] [],
  _closeTimer: null,
  _extensions: {},
  _paused: false,
  _protocol: '',
  _readyState: 2,
  _receiver: null,
  _sender: null,
  _socket: null,
  _bufferedAmount: 0,
  _isServer: false,
  _redirects: 0,
  _url: 'ws://localhost:2333/v4/websocket',
  _req: null,
  [Symbol(kCapture)]: false
},
rest: <ref *4> Pool {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  [Symbol(kCapture)]: false,
  [Symbol(destroyed)]: false,
  [Symbol(onDestroyed)]: null,
  [Symbol(closed)]: false,
  [Symbol(onClosed)]: [],
  [Symbol(queue)]: FixedQueue {
    tail: FixedCircularBuffer {
      bottom: 0,
      top: 0,
      list: [ <2048 empty items> ],
      next: null
    },
    head: FixedCircularBuffer {
      bottom: 0,
      top: 0,
      list: [ <2048 empty items> ],
      next: null
    }
  },
  [Symbol(clients)]: [],
  [Symbol(queued)]: 0,
  [Symbol(onDrain)]: [Function: onDrain],
  [Symbol(onConnect)]: [Function (anonymous)],
  [Symbol(onDisconnect)]: [Function (anonymous)],
  [Symbol(onConnectionError)]: [Function (anonymous)],
  [Symbol(stats)]: PoolStats { [Symbol(pool)]: [Circular *4] },
  [Symbol(dispatch interceptors)]: [],
  [Symbol(connections)]: null,
  [Symbol(url)]: <ref *5> URL {
    [Symbol(context)]: URLContext {
      flags: 400,
      scheme: 'http:',
      username: '',
      password: '',
      host: 'localhost',
      port: 2333,
      path: [ '' ],
      query: null,
      fragment: null
    },
    [Symbol(query)]: URLSearchParams {
      [Symbol(query)]: [],
      [Symbol(context)]: [Circular *5]
    }
  },
  [Symbol(options)]: {
    connect: [Function: connect],
    allowH2: undefined,
    interceptors: undefined
  },
  [Symbol(factory)]: [Function: defaultFactory]
},
version: 'v4',
decode: {
  singleTrack: [AsyncFunction: singleTrack],
  multipleTracks: [AsyncFunction: multipleTracks]
},
routePlannerApi: {
  getStatus: [AsyncFunction: getStatus],
  unmarkFailedAddress: [AsyncFunction: unmarkFailedAddress],
  unmarkAllFailedAddresses: [AsyncFunction: unmarkAllFailedAddresses]
}

} }`

Tomato6966 commented 10 months ago

Well I don't know what the error caused, nor when the error happend. But it seems like it couldn't build the connection (websocket) to the lavalink server.

You sure that your lavalink server runs on v4?

Tomato6966 commented 9 months ago

I'm closing this now, try to do the following: Use lavalink's .jar version: beta v4 aka beta latest Use the latest lavalink-client version