Skip to content

invalid slice name error should clarify min valid length is 3 #158

Closed

Description

@polarathene

This error confused me a bit at first, why was it invalid? Eventually I noticed a length of 3 characters for a slice key was successful. Looked up the source and the restriction appears to be due to a regex pattern constraint.

Perhaps in this case the error message could better indicate the failure was due to a minimum expected length?

$ chisel find --release /opt/chisel-release base-distroless
2024/09/11 04:48:18 Processing /opt/chisel-release release...
error: invalid slice name "cc" in slices/base-distroless.yaml

for sliceName, yamlSlice := range yamlPkg.Slices {
match := snameExp.FindStringSubmatch(sliceName)
if match == nil {
return nil, fmt.Errorf("invalid slice name %q in %s", sliceName, pkgPath)
}

// snameExp matches only the slice name, without the leading package name.
var snameExp = regexp.MustCompile(`^([a-z](?:-?[a-z0-9]){2,})$`)

Activity

  1. cjdcordeiro commented on Sep 11, 2024

    @cjdcordeiro
    Collaborator

    Thanks for suggesting this improvement @polarathene .

    We'll keep this open for being picked up into our backlog ;)

  2. gajeshbhat commented on Aug 16, 2025

    @gajeshbhat
    Contributor

    Hey @cjdcordeiro , I put up a PR to address this. Please let me know if you have any questions. Cheers. CC: @polarathene

  3. letFunny commented on Aug 21, 2025

    @letFunny
    Collaborator

    Hey @gajeshbhat, thank you for the PR, let's discuss it there. Please be patient because we are about to finish two major features, so we will keep it on hold for a week more or less.

  4. gajeshbhat commented on Aug 23, 2025

    @gajeshbhat
    Contributor

    Hey @gajeshbhat, thank you for the PR, let's discuss it there. Please be patient because we are about to finish two major features, so we will keep it on hold for a week more or less.

    Hi @letFunny, Thank you for the feedback on the PR. I completely understand prioritizing the major features - no rush at all.

  5. added a commit that references this issue on Aug 29, 2025
    680d53c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SimpleNice for a quick look on a minute or two

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions