{"record":{"id":"b29f9ed741377691","repo":"linera-io/linera-protocol","slug":"start-timestamp-before-1970","errorCode":null,"errorMessage":"Start timestamp before 1970","messagePattern":"Start timestamp before 1970","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-service/src/cli/main.rs","lineNumber":2419,"sourceCode":"                    })\n                    .transpose()\n                    .expect(\"Invalid application ID\")\n                    .unwrap_or(existing_policy.free_application_ids),\n                flags: flags\n                    .as_ref()\n                    .map(|values| {\n                        values\n                            .iter()\n                            .map(|s| s.parse())\n                            .collect::<Result<BTreeSet<_>, _>>()\n                    })\n                    .transpose()\n                    .expect(\"Invalid protocol flag\")\n                    .unwrap_or(existing_policy.flags),\n            };\n            let timestamp = start_timestamp.map_or_else(Timestamp::now, |st| {\n                let micros =\n                    u64::try_from(st.timestamp_micros()).expect(\"Start timestamp before 1970\");\n                Timestamp::from(micros)\n            });\n\n            let mut keystore = options.create_keystore(*testing_prng_seed)?;\n            let admin_public_key = keystore.generate_key().await?;\n\n            let network_name = network_name.clone().unwrap_or_else(|| {\n                // Default: e.g. \"linera-2023-11-14T23:13:20\"\n                format!(\"linera-{}\", Utc::now().naive_utc().format(\"%FT%T\"))\n            });\n            let mut genesis_config = persistent::File::new(\n                genesis_config_path,\n                committee_config.into_genesis(\n                    timestamp,\n                    policy,\n                    network_name,\n                    admin_public_key,\n                    *initial_funding,","sourceCodeStart":2401,"sourceCodeEnd":2437,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/main.rs#L2401-L2437","documentation":"create-genesis-config converts the --start-timestamp DateTime into microseconds since epoch via u64::try_from(st.timestamp_micros()). If the start timestamp is before 1970-01-01, timestamp_micros() is negative, the conversion returns Err, and .expect(\"Start timestamp before 1970\") panics while computing the genesis timestamp.","triggerScenarios":"Passing --start-timestamp with a pre-epoch date (year < 1970): a typo like 1026 instead of 2026, a negative epoch offset, or a misparsed local-time string that lands before the epoch.","commonSituations":"Scripted date arithmetic producing negative epoch values; typo'd ISO-8601 years; timestamps generated from uninitialized clocks or default zero-values interpreted as pre-epoch.","solutions":["Supply a start timestamp at or after 1970, normally the intended near-future time: --start-timestamp '2026-09-01T00:00:00Z'","Omit --start-timestamp to default to Timestamp::now if an explicit start is unnecessary","Add a date sanity check to the genesis script (year >= 1970, value in the future) before running the CLI"],"exampleFix":"# before\nlinera create-genesis-config ... --start-timestamp 1969-01-01T00:00:00Z\n\n# after\nlinera create-genesis-config ... --start-timestamp 2026-09-01T00:00:00Z","handlingStrategy":"validation","validationCode":"# Sanity-check the start timestamp before create-genesis-config.\nSTART_TS='2026-09-01T00:00:00Z'\nepoch=$(date -u -d \"$START_TS\" +%s)\n[ \"$epoch\" -gt 0 ] || { echo 'start timestamp must be after 1970' >&2; exit 1; }\nlinera create-genesis-config ... --start-timestamp \"$START_TS\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compute start timestamps from now + offset instead of literal dates","Lint every timestamp literal in genesis scripts for plausible year ranges","Default to omitting --start-timestamp unless deterministic genesis timing is required"],"tags":["linera","cli","genesis","timestamp","unix-epoch"],"backgroundTag":"invalid-timestamp","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}