Multisite installation (Subdomain): Uh-oh! Unable to start site. TypeError: Cannot convert undefined or null to object

I’m trying to start a multisite (sub domains) installation: once stopped, Local WP is not able to start it again as it shows the message below.

Please, while the team fixes this, any guidance about how to fix the issue “manually” is welcome.

Bug Summary

Uh-oh! Unable to start site.

TypeError: Cannot convert undefined or null to object

at Function.entries ()

at PortsService. (/Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:107:62)

at Generator.next ()

at /Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:8:71

at new Promise ()

at __awaiter (/Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:4:12)

at PortsService.checkAndReplaceUnavailablePorts (/Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:101:16)

at SiteProcessManagerService. (/Applications/Local.app/Contents/Resources/app.asar/main/sites/SiteProcessManagerService.js:271:57)

at Generator.next ()

at fulfilled (/Applications/Local.app/Contents/Resources/app.asar/main/sites/SiteProcessManagerService.js:5:58)

Steps to reproduce

1. Create a multi-site installation

Custom environment

  • PHP: 8.3.11
  • Web server: Apache 2.4.43
  • Database: MySQL 8.0.35

Set up WordPress

  • Advanced options
    • Language: Italiano
    • Is This WordPress Multisite?: Yes - Subdomain

Environment Info

It is a problem of a missed check in the code, not an environment problem (I suppose from what I read in the error)

Supporting info

If required, I will.

Please could you share your logs, @aerendir?

Hi @nickc ,

attached are the logs.

Thanks for your reply

local-logs.zip (61.1 KB)

Thanks for these logs, @Aerendir. It’s possible your sites.json is missing port info or otherwise malformed.

I’ll send you a direct message shortly so that you can share it with me if you wish, to avoid you having to share it publicly here.

@nickc , I just sent you the sites.json file. I also added other info.

For the casual reader of this post, the main thing to keep in mind is: it may be possible the site can start completely closing Local WP and then reopening it.

Thanks for the sites.json file, @Aerendir. For others, it showed missing ports for the Mailpit service, which would cause the “Cannot convert undefined or null to object” error you saw.

So far I haven’t been able to reproduce missing Mailpit ports after stopping a site, but I’ll leave this open for now in case others encounter it.

Thank you for posting your workaround here to stop and restart Local should people see this.

1 Like

Hi! I faced the same issue.. It happens right after I try to turn on Xdebug.. Local restart and computer restart don’t help. site.json is missing the ports, but I don’t know how to fix it. It strangely happens to fresh instances only. I have xdebug turned on on some another website. Let me know how can I help you investigate it

Hi, @victoria.barysevich! You can try the advice here:

I followed both instructions, and nothing helped..
local-logs.zip was too big, so I extracted verbose logs to a separate archive

local-logs.zip (25.6 MB)

local-logs-verbose.zip (19.3 MB)

I added ports with empty WEB and SMTP arrays. After that, I started the local and problematic instance, and it started without errors

1 Like

Thanks for letting us know how you solved this, @victoria.barysevich.