docmirror/dev-sidecar · warning

不支持此操作

Error message

不支持此操作

What it means

The `enable-loopback` shell script implements loopback exemption only for Windows; its `linux` handler is an explicit placeholder that throws `不支持此操作` (operation not supported). Loopback unblocking is a Windows-specific network restriction workaround, so on Linux the operation is intentionally unavailable.

Source

Thrown at packages/core/src/shell/scripts/enable-loopback.js:36

      sudoPrompt.exec(
        sudoCommand.join(' '),
        options,
        (error, _, stderr) => {
          if (stderr) {
            log.error(`[sudo-prompt] 发生错误: ${stderr}`)
          }

          if (error) {
            reject(error)
          } else {
            resolve(undefined)
          }
        },
      )
    })
  },
  async linux (exec, { port }) {
    throw new Error('不支持此操作')
  },
  async mac (exec, { port }) {
    throw new Error('不支持此操作')
  },
}

module.exports = async function (args) {
  return execute(executor, args)
}

View on GitHub (pinned to 7710cd56cc)

Solutions

  1. Do not invoke enable-loopback on Linux — it is not needed there; guard the call behind a platform check.
  2. If you need equivalent behavior, implement the linux handler yourself (e.g. no-op returning success) in a fork.
  3. Update config so `systemProxy`/loopback-related settings do not trigger this script on Linux.

Example fix

// before
await DevSidecar.shell.enableLoopback({ port })
// after
if (process.platform === 'win32') {
  await DevSidecar.shell.enableLoopback({ port })
}
Defensive patterns

Strategy: fallback

Validate before calling

if (process.platform !== 'win32') {
  console.info('enable-loopback is Windows-only; skipping')
  return
}

Type guard

function supportsLoopback () {
  return process.platform === 'win32'
}

Try / catch

try {
  await DevSidecar.shell.enableLoopback({ port })
} catch (err) {
  if (err.message === '不支持此操作') {
    log.info('loopback exemption not supported on this platform; ignored')
  } else { throw err }
}

Prevention

When it happens

Trigger: Calling the enable-loopback shell API (`DevSidecar.shell.enableLoopback` / scripts/enable-loopback.js) while `getPlatform()` resolves to `linux`, so dispatch lands on the `linux` stub.

Common situations: Running the GUI/CLI on Linux where startup or a user action tries to apply Windows-only loopback settings; cross-platform scripts copied from Windows documentation.

Related errors


AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31). Data as JSON: /api/errors/87249c7b810e7f1f. Report an issue: GitHub.