juicedata/juicefs · error

panic in point get transaction

Error message

panic in point get transaction: %v

What it means

In tikvClient.simpleTxn (pkg/meta/tkv_tikv.go:345), the deferred recover() converts a panic raised while executing the point-get callback f into "panic in point get transaction: %v" (passing it through unchanged if it is already an error). It guards metadata reads against panics inside the TiKV transaction body.

Solutions

  1. Capture the stack trace printed by debug.PrintStack in the client log and identify which decode/scan panicked.
  2. Run `juicefs fsck` against the volume to find corrupt or incompatible metadata entries and repair/remove them.
  3. Align JuiceFS client and TiKV cluster versions (upgrade tikv-client-go via a newer JuiceFS release) and retry; restore from a metadata backup if records are irrecoverably corrupt.
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: verify metadata integrity
// juicefs fsck tikv://pd:2379/volume

Try / catch

if err := doMetaOp(); err != nil {
    if strings.HasPrefix(err.Error(), "panic in point get transaction:") {
        // inspect the printed stack, fsck the volume, align client/TiKV versions
    }
}

Prevention

When it happens

Trigger: A point-get via simpleTxn panics inside the kvTxn callback: nil key/value handling on malformed records, decode errors on unexpected value formats, or lower-level tikv-client-go panics (e.g. on region errors during raw scans).

Common situations: Metadata values written by a different (incompatible) JuiceFS version or corrupted in the TiKV store; tikv-client-go internal bugs triggered by region merges/splits mid-read; manual edits of the TiKV data.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at pkg/meta/tkv_tikv.go:345

			logger.Warnf("TiKV get startTS: %s", err)
			return nil
		}
		return ts
	}
	return nil
}

func (c *tikvClient) simpleTxn(ctx context.Context, f func(*kvTxn) error, retry int) (err error) {
	tx, err := c.client.Begin(tikv.WithStartTS(math.MaxUint64)) // math.MaxUint64 means to point get the latest committed data without PD access
	if err != nil {
		return errors.Wrap(err, "failed to begin transaction")
	}
	defer func() {
		if r := recover(); r != nil {
			if e, ok := r.(error); ok {
				err = e
			} else {
				err = errors.Errorf("panic in point get transaction: %v", r)
			}
		}
	}()
	if err = f(&kvTxn{&tikvTxn{tx}, retry}); err != nil {
		return err
	}
	if !tx.IsReadOnly() {
		return syscall.EINVAL
	}
	return nil
}

func (c *tikvClient) txn(ctx context.Context, f func(*kvTxn) error, retry int) (err error) {
	var opts []tikv.TxnOption
	if val := ctx.Value(txSessionKey{}); val != nil {
		opts = append(opts, tikv.WithStartTS(val.(uint64)))
	}

View on GitHub (pinned to c9a67b23e8)