{"record":{"id":"d2cbe4bfd98489d4","repo":"kataras/iris","slug":"path-is-required","errorCode":null,"errorMessage":"path is required","messagePattern":"path is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sessions/sessiondb/boltdb/database.go","lineNumber":33,"sourceCode":"\n// DefaultFileMode used as the default database's \"fileMode\"\n// for creating the sessions directory path, opening and write\n// the session boltdb(file-based) storage.\nvar (\n\tDefaultFileMode = 0755\n)\n\n// Database the BoltDB(file-based) session storage.\ntype Database struct {\n\ttable []byte\n\t// Service is the underline BoltDB database connection,\n\t// it's initialized at `New` or `NewFromDB`.\n\t// Can be used to get stats.\n\tService *bolt.DB\n\tlogger  *golog.Logger\n}\n\nvar errPathMissing = errors.New(\"path is required\")\n\n// New creates and returns a new BoltDB(file-based) storage\n// instance based on the \"path\".\n// Path should include the filename and the directory(aka fullpath), i.e sessions/store.db.\n//\n// It will remove any old session files.\nfunc New(path string, fileMode os.FileMode) (*Database, error) {\n\tif path == \"\" {\n\t\tgolog.Error(errPathMissing)\n\t\treturn nil, errPathMissing\n\t}\n\n\tif fileMode == 0 {\n\t\tfileMode = os.FileMode(DefaultFileMode)\n\t}\n\n\t// create directories if necessary\n\tif err := os.MkdirAll(filepath.Dir(path), fileMode); err != nil {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/sessions/sessiondb/boltdb/database.go#L15-L51","documentation":"errPathMissing is the unexported sentinel returned by the BoltDB session database's New when the path argument is empty. BoltDB is a file-based store, so the path must include both directory and filename (e.g. sessions/store.db) and cannot be blank.","triggerScenarios":"Calling boltdb.New(\"\") while registering the session database — typically when the path comes from an unset env var, empty config struct field, or omitted CLI flag.","commonSituations":"Deployment where the DB_FILE/SESSION_DB_PATH env var is missing; config file lacking the path key; using the wrong constructor (NewFromDB expects an open *bolt.DB instead of a path).","solutions":["Pass a full path including filename, e.g. boltdb.New(\"sessions/store.db\").","Validate the config value at startup and return a clear error before calling New.","Ensure the parent directory exists and the process has write permissions.","If you already have an open bolt.DB, use NewFromDB instead of New."],"exampleFix":"// before\ndb, err := boltdb.New(\"\") // error: path is required\n\n// after\ndb, err := boltdb.New(\"sessions/store.db\")","handlingStrategy":"validation","validationCode":"const p = os.Getenv(\"SESSION_BOLTDB_PATH\")\nif p == \"\" || filepath.Ext(p) != \".db\" {\n    log.Fatal(\"SESSION_BOLTDB_PATH must be a full path incl. filename, e.g. sessions/store.db\")\n}\ndb, err := boltdb.New(p)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the filename in the BoltDB path (fullpath, not directory).","Validate config at startup, before New.","Ensure the target directory exists and is writable."],"tags":["sessions","boltdb","configuration","iris"],"backgroundTag":"missing-config-path","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}