kubernetes/kops · error

invalid file mode for %q: %q

Error message

invalid file mode for %q: %q

What it means

Error "invalid file mode for %q: %q" thrown in kubernetes/kops.

Source

Thrown at upup/pkg/fi/nodeup/nodetasks/file.go:251

func (i *InstallFile) CheckChanges(a, e, changes *InstallFile) error {
	return nil
}

func (i *InstallFile) RenderInstall(_ *install.InstallTarget, a, e, changes *InstallFile) error {
	var actual *File
	if a != nil {
		actual = &a.File
	}

	return i.File.RenderLocal(nil, actual, &e.File, &changes.File)
}

func (_ *File) RenderLocal(_ *local.LocalTarget, a, e, changes *File) error {
	dirMode := os.FileMode(0o755)
	fileMode, err := fi.ParseFileMode(fi.ValueOf(e.Mode), 0o644)
	if err != nil {
		return fmt.Errorf("invalid file mode for %q: %q", e.Path, fi.ValueOf(e.Mode))
	}

	if a != nil {
		if e.IfNotExists {
			klog.V(2).Infof("file exists and IfNotExists set; skipping %q", e.Path)
			return nil
		}
	}

	changed := false
	switch e.Type {
	case FileType_Symlink:
		if changes.Symlink != nil {
			// This will currently fail if the target already exists.
			// That's probably a good thing for now ... it is hard to know what to do here!
			klog.Infof("Creating symlink %q -> %q", e.Path, *changes.Symlink)
			err := os.Symlink(*changes.Symlink, e.Path)
			if err != nil {

View on GitHub (pinned to 4c8573c808)

When it happens

Trigger: Thrown at upup/pkg/fi/nodeup/nodetasks/file.go:251 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/5787db170c9089db. Report an issue: GitHub.