{"record":{"id":"bb784e9e32e50a28","repo":"microsoft/playwright","slug":"path-expected-guid-for-names-tostring","errorCode":null,"errorMessage":"${path}: expected guid for ${names.toString()}","messagePattern":"(.+?): expected guid for (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/dispatchers/dispatcher.ts","lineNumber":253,"sourceCode":"  private _validatorFromWireContext(): ValidatorContext {\n    return {\n      tChannelImpl: this._tChannelImplFromWire.bind(this),\n      binary: this._isInProcess ? 'buffer' : 'fromBase64',\n      isUnderTest,\n    };\n  }\n\n  private _tChannelImplFromWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext): any {\n    if (arg && typeof arg === 'object' && typeof arg.guid === 'string') {\n      const guid = arg.guid;\n      const dispatcher = this._dispatcherByGuid.get(guid);\n      if (!dispatcher)\n        throw new ValidationError(`${path}: no object with guid ${guid}`);\n      if (names !== '*' && !names.includes(dispatcher._type))\n        throw new ValidationError(`${path}: object with guid ${guid} has type ${dispatcher._type}, expected ${names.toString()}`);\n      return dispatcher;\n    }\n    throw new ValidationError(`${path}: expected guid for ${names.toString()}`);\n  }\n\n  private _tChannelImplToWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext): any {\n    if (arg instanceof Dispatcher)  {\n      if (names !== '*' && !names.includes(arg._type))\n        throw new ValidationError(`${path}: dispatcher with guid ${arg._guid} has type ${arg._type}, expected ${names.toString()}`);\n      return { guid: arg._guid };\n    }\n    throw new ValidationError(`${path}: expected dispatcher ${names.toString()}`);\n  }\n\n  existingDispatcher<DispatcherType>(object: any): DispatcherType | undefined {\n    return this._dispatcherByObject.get(object) as DispatcherType | undefined;\n  }\n\n  registerDispatcher(dispatcher: DispatcherScope) {\n    assert(!this._dispatcherByGuid.has(dispatcher._guid));\n    this._dispatcherByGuid.set(dispatcher._guid, dispatcher);","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/dispatchers/dispatcher.ts#L235-L271","documentation":"ValidationError raised in _tChannelImplFromWire when the argument for a channel parameter is not an object containing a string guid. The wire format requires { guid: string }; anything else — a primitive, null, an array, or an object whose guid is missing/non-string — falls through to this error before any lookup. It signals malformed input rather than a missing or wrong object.","triggerScenarios":"Sending null/undefined/''/0 for a channel parameter, an object without a guid field, or an object whose guid is a number/boolean. Happens in hand-rolled serializers, buggy proxy code, or when a handle variable is undefined due to a missing await.","commonSituations":"A handle variable that was never assigned (e.g. const page; then used before newPage resolved), JSON that stripped the guid, or custom marshalling that loses the field.","solutions":["Ensure every channel argument is an actual handle object obtained from a prior RPC on the same connection.","Add a pre-send assertion: assert(arg && typeof arg === 'object' && typeof arg.guid === 'string').","Use the typed client API rather than building raw protocol messages."],"exampleFix":"// before: undefined handle sent as channel arg\nawait connection.send('page', 'close', { page }); // page is undefined\n\n// after: assign before use\nconst page = await browser.newPage();\nawait connection.send('page', 'close', { page });","handlingStrategy":"validation","validationCode":"function isValidWireHandle(arg: any): boolean {\n  return !!arg && typeof arg === 'object' && typeof arg.guid === 'string' && arg.guid.length > 0;\n}","typeGuard":"function isWireHandle(arg: any): arg is { guid: string } {\n  return !!arg && typeof arg === 'object' && typeof arg.guid === 'string';\n}","tryCatchPattern":null,"preventionTips":["Always assign handles from real RPC results before using them in another RPC.","Add a pre-send shape check for any hand-built protocol message.","Prefer the typed client API over constructing wire objects manually."],"tags":["protocol","validation","wire-format","guid"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}