juicedata/juicefs · error

new GCM: %s

Error message

new GCM: %s

What it means

Returned by newCipher in pkg/meta/config.go when cipher.NewGCM fails on the AES block built from the MD5-hashed key. As with the other newCipher errors, this is expected to be unreachable with a valid AES block and indicates an unexpected crypto-layer failure. Raised through Format.Encrypt/Decrypt.

Source

Thrown at pkg/meta/config.go:227

	case object.SM4GCM:
		block, err := sm4.NewCipher(sm3.Kdf([]byte(key), 16))
		if err != nil {
			return nil, fmt.Errorf("new sm4 cipher: %s", err)
		}
		aead, err := cipher.NewGCM(block)
		if err != nil {
			return nil, fmt.Errorf("new sm4 GCM: %s", err)
		}
		return aead, nil
	default:
		hashKey := md5.Sum([]byte(key))
		block, err := aes.NewCipher(hashKey[:])
		if err != nil {
			return nil, fmt.Errorf("new cipher: %s", err)
		}
		aead, err := cipher.NewGCM(block)
		if err != nil {
			return nil, fmt.Errorf("new GCM: %s", err)
		}
		return aead, nil
	}
}

func (f *Format) Encrypt() error {
	if f.KeyEncrypted || f.SecretKey == "" && f.EncryptKey == "" && f.SessionToken == "" {
		return nil
	}
	ci, err := newCipher(f.EncryptAlgo, f.UUID)
	if err != nil {
		return err
	}
	encrypt := func(k *string) {
		if *k == "" {
			return
		}
		nonce := make([]byte, ci.NonceSize())

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Rebuild JuiceFS with a standard Go toolchain
  2. Check the wrapped error message for the concrete GCM failure
  3. Use `juicefs config` to change EncryptAlgorithm and isolate the failing code path
Defensive patterns

Strategy: try-catch

Try / catch

if err := format.Encrypt(); err != nil { if strings.Contains(err.Error(), "new GCM") { /* treat as environment/crypto-stack problem, not config */ } }

Prevention

When it happens

Trigger: Format.Encrypt()/Format.Decrypt() on the default path where cipher.NewGCM(aesBlock) returns an error.

Common situations: Only with broken or modified Go crypto runtimes; not a user-fixable configuration issue.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/26b54e8fba0f86c2. Report an issue: GitHub.