{"record":{"id":"3e7128a9a204e7a2","repo":"hyperledger/fabric","slug":"invalid-path-s-the-path-for-the-snapshot-dir-is","errorCode":null,"errorMessage":"invalid path: %s. The path for the snapshot dir is expected to be an absolute path","messagePattern":"invalid path: (.+?)\\. The path for the snapshot dir is expected to be an absolute path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/ledger/kvledger/kv_ledger_provider.go","lineNumber":251,"sourceCode":"\tsysNamespaces := p.initializer.DeployedChaincodeInfoProvider.Namespaces()\n\tp.dbProvider, err = privacyenabledstate.NewDBProvider(\n\t\tp.bookkeepingProvider,\n\t\tp.initializer.MetricsProvider,\n\t\tp.initializer.HealthCheckRegistry,\n\t\tstateDBConfig,\n\t\tsysNamespaces,\n\t)\n\treturn err\n}\n\nfunc (p *Provider) initLedgerStatistics() {\n\tp.stats = newStats(p.initializer.MetricsProvider)\n}\n\nfunc (p *Provider) initSnapshotDir() error {\n\tsnapshotsRootDir := p.initializer.Config.SnapshotsConfig.RootDir\n\tif !filepath.IsAbs(snapshotsRootDir) {\n\t\treturn errors.Errorf(\"invalid path: %s. The path for the snapshot dir is expected to be an absolute path\", snapshotsRootDir)\n\t}\n\n\tinProgressSnapshotsPath := SnapshotsTempDirPath(snapshotsRootDir)\n\tcompletedSnapshotsPath := CompletedSnapshotsPath(snapshotsRootDir)\n\n\tif err := os.RemoveAll(inProgressSnapshotsPath); err != nil {\n\t\treturn errors.Wrapf(err, \"error while deleting the dir: %s\", inProgressSnapshotsPath)\n\t}\n\tif err := os.MkdirAll(inProgressSnapshotsPath, 0o755); err != nil {\n\t\treturn errors.Wrapf(err, \"error while creating the dir: %s, ensure peer has write access to configured ledger.snapshots.rootDir directory\", inProgressSnapshotsPath)\n\t}\n\tif err := os.MkdirAll(completedSnapshotsPath, 0o755); err != nil {\n\t\treturn errors.Wrapf(err, \"error while creating the dir: %s, ensure peer has write access to configured ledger.snapshots.rootDir directory\", completedSnapshotsPath)\n\t}\n\treturn fileutil.SyncDir(snapshotsRootDir)\n}\n\n// CreateFromGenesisBlock implements the corresponding method from interface ledger.PeerLedgerProvider","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/ledger/kvledger/kv_ledger_provider.go#L233-L269","documentation":"initSnapshotDir validates that the configured snapshots root directory (ledger.snapshots.rootDir in core.yaml) is an absolute path. Relative paths would resolve unpredictably relative to the peer's working directory, so NewProvider fails fast with this error.","triggerScenarios":"Peer startup (NewProvider -> initSnapshotDir) with a relative value for ledger.snapshots.rootDir, e.g. 'snapshots' or './snapshots' instead of '/var/hyperledger/production/snapshots'.","commonSituations":"Hand-edited core.yaml, environment-specific config templates that dropped the leading slash, or container deployments mounting the snapshots dir at a path but configuring it relatively.","solutions":["Set ledger.snapshots.rootDir to an absolute path in core.yaml (e.g. /var/hyperledger/production/snapshots)","Verify with 'peer node start' config dump that the resolved value begins with '/'","Fix config templates/overlays that produce a relative path"],"exampleFix":"# before (core.yaml)\nledger:\n  snapshots:\n    rootDir: snapshots\n# after\nledger:\n  snapshots:\n    rootDir: /var/hyperledger/production/snapshots","handlingStrategy":"validation","validationCode":"rootDir := viper.GetString(\"ledger.snapshots.rootDir\")\nif !filepath.IsAbs(rootDir) {\n    return fmt.Errorf(\"ledger.snapshots.rootDir must be absolute, got %q\", rootDir)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure ledger.snapshots.rootDir with a leading '/' absolute path","Validate core.yaml values with configlint or a peer dry-run in CI","Avoid relative defaults in generated config templates"],"tags":["hyperledger-fabric","configuration","snapshot","path-validation"],"backgroundTag":"path-must-be-absolute","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}