slimtoolkit/slim · error

sensor: artifact - getNuxtConfig - error getting file => %s

Error message

sensor: artifact - getNuxtConfig - error getting file => %s

What it means

getNuxtConfig locates and parses a Nuxt app's nuxt.config file. Before reading, it stats the path; if os.Stat fails with os.IsNotExist, it returns this error naming the missing file path. The underlying stat error is only logged at debug level, so the returned message carries just the path.

Source

Thrown at pkg/app/sensor/artifact/artifact.go:3016

						}
					}
				}
			}
		}
	}

	return nil
}

type nuxtDirs struct {
	Build string
	Dist  string
}

func getNuxtConfig(path string) (*nuxtDirs, error) {
	if _, err := os.Stat(path); err != nil && os.IsNotExist(err) {
		log.Debugf("sensor: monitor - getNuxtConfig - err stat => %s - %s", path, err.Error())
		return nil, fmt.Errorf("sensor: artifact - getNuxtConfig - error getting file => %s", path)
	}

	dat, err := os.ReadFile(path)
	if err != nil {
		log.Debugf("sensor: monitor - getNuxtConfig - err reading file => %s - %s", path, err.Error())
		return nil, fmt.Errorf("sensor: artifact - getNuxtConfig - error reading file => %s", path)
	}

	log.Tracef("sensor: monitor - getNuxtConfig(%s) - %s", path, string(dat))

	nuxt := nuxtDirs{
		Build: nuxtDefaultBuildDir,
		Dist:  fmt.Sprintf("%s/%s", nuxtDefaultBuildDir, nuxtDefaultDistDir),
	}

	/*
		todo: need more test apps to verify this part of the code
		vm := otto.New()

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Verify the file exists at the given path (ls the directory) and correct the path passed in.
  2. Support nuxt.config.ts as an alternative filename when nuxt.config.js is absent.
  3. Check the debug log line ('getNuxtConfig - err stat') for the precise stat error.
  4. Skip Nuxt analysis gracefully when the config file is absent, since the app may not be Nuxt.

Example fix

// before
cfg, err := getNuxtConfig(filepath.Join(appDir, "nuxt.config.js"))
// after
configPath := filepath.Join(appDir, "nuxt.config.js")
if _, err := os.Stat(configPath); os.IsNotExist(err) {
    configPath = filepath.Join(appDir, "nuxt.config.ts")
}
cfg, err := getNuxtConfig(configPath)
Defensive patterns

Strategy: validation

Validate before calling

configPath := filepath.Join(appDir, "nuxt.config.js")
if _, err := os.Stat(configPath); os.IsNotExist(err) {
    tsPath := filepath.Join(appDir, "nuxt.config.ts")
    if _, err2 := os.Stat(tsPath); err2 == nil {
        configPath = tsPath
    } else {
        return nil // not a Nuxt app; skip analysis
    }
}

Try / catch

nuxt, err := getNuxtConfig(configPath)
if err != nil {
    if strings.Contains(err.Error(), "error getting file") {
        log.Warnf("nuxt config missing at %s; skipping nuxt analysis", configPath)
        return nil
    }
    return err
}

Prevention

When it happens

Trigger: Calling getNuxtConfig (via the Nuxt artifact analysis flow) with a path to nuxt.config.js that does not exist on disk — wrong app directory, renamed config, or the framework not being Nuxt at all.

Common situations: Nuxt 3 projects using nuxt.config.ts instead of nuxt.config.js; container images built with the config excluded; analyzing an app directory that is not a Nuxt project.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/2b4392e40f82dc4f. Report an issue: GitHub.