wavetermdev/waveterm · error

failed to parse app id: %w

Error message

failed to parse app id: %w

What it means

The appId string supplied to BuilderController.buildAndRun could not be parsed by waveappstore.ParseAppId, so the app namespace could not be resolved. This aborts the build before any compilation happens and routes the error to handleBuildError.

Source

Thrown at pkg/buildercontroller/buildercontroller.go:196

		bc.publishOutputLine(line, false)
	})

	buildCtx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
	go func() {
		defer cancel()
		defer func() {
			panichandler.PanicHandler(fmt.Sprintf("buildercontroller[%s].buildAndRun", bc.builderId), recover())
		}()
		bc.buildAndRun(buildCtx, appId, builderEnv, nil)
	}()

	return nil
}

func (bc *BuilderController) buildAndRun(ctx context.Context, appId string, builderEnv map[string]string, resultCh chan<- *BuildResult) {
	appNS, _, err := waveappstore.ParseAppId(appId)
	if err != nil {
		bc.handleBuildError(fmt.Errorf("failed to parse app id: %w", err), resultCh)
		return
	}

	appPath, err := waveappstore.GetAppDir(appId)
	if err != nil {
		bc.handleBuildError(fmt.Errorf("failed to get app directory: %w", err), resultCh)
		return
	}

	cachePath, err := GetBuilderAppExecutablePath(appPath)
	if err != nil {
		bc.handleBuildError(fmt.Errorf("failed to get builder executable path: %w", err), resultCh)
		return
	}

	nodePath := wavebase.GetWaveAppElectronExecPath()
	if nodePath == "" {
		bc.handleBuildError(fmt.Errorf("electron executable path not set"), resultCh)

View on GitHub (pinned to a4447c1563)

Solutions

  1. Validate the appId format before calling the builder (namespace:name pattern)
  2. Fix the block metadata/config carrying the bad appId
  3. Reinstall/re-create the app to get a correctly formatted id
  4. Check waveappstore.ParseAppId for the exact accepted format

Example fix

// before
bc.buildAndRun(ctx, appId, env, resultCh)
// after
if _, _, err := waveappstore.ParseAppId(appId); err != nil {
	log.Printf("invalid app id: %q", appId)
	return
}
bc.buildAndRun(ctx, appId, env, resultCh)
Defensive patterns

Strategy: validation

Validate before calling

ns, name, err := waveappstore.ParseAppId(appId)
if err != nil || ns == "" || name == "" {
	// reject before invoking the builder
}

Type guard

func isValidAppId(appId string) bool {
	_, _, err := waveappstore.ParseAppId(appId)
	return err == nil
}

Try / catch

resCh := make(chan *BuildResult)
go bc.buildAndRun(ctx, appId, env, resCh)
res := <-resCh
if res != nil && res.Error != nil && strings.Contains(res.Error.Error(), "failed to parse app id") {
	// prompt user to fix app id
}

Prevention

When it happens

Trigger: buildAndRun invoked (via RunBuild/anonymous caller) with a malformed appId that does not match the expected app-id format (e.g. missing namespace separator, empty, or containing invalid characters).

Common situations: Stale block metadata pointing at an app id from an older format; hand-edited config; caller passing a block id instead of an app id.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/0086008a163496b6. Report an issue: GitHub.