siyuan-note/siyuan · error
parse created [ ] failed
Error message
parse created [%s] failed: %w
What it means
ResolveHistoryAttributeViewBoxID parses the history 'created' timestamp as a Unix seconds integer to build the history directory prefix. If the string is not a valid integer, strconv.ParseInt fails and the error is wrapped with the offending value for diagnostics.
Solutions
- Pass created as a Unix-seconds integer string (e.g. "1726963200")
- Convert any other timestamp format to Unix seconds before calling
- Check the history entry source for corrupted or empty created values
Example fix
// before boxID, err := model.ResolveHistoryAttributeViewBoxID(avID, "2026-09-18 10:00:00") // after created := strconv.FormatInt(entry.Created.Unix(), 10) boxID, err := model.ResolveHistoryAttributeViewBoxID(avID, created)
Defensive patterns
Strategy: validation
Validate before calling
createdUnix, err := strconv.ParseInt(created, 10, 64)
if err != nil { return fmt.Errorf("created must be unix seconds, got %q", created) } Try / catch
boxID, err := model.ResolveHistoryAttributeViewBoxID(avID, created)
if err != nil && strings.HasPrefix(err.Error(), "parse created") {
return ErrBadHistoryTimestamp
} Prevention
- Always pass Unix-seconds strings for history timestamps
- Convert UI date objects with Math.floor(date.getTime()/1000) before sending
- Validate history metadata fields at ingestion time
When it happens
Trigger: Calling ResolveHistoryAttributeViewBoxID with a created value that is empty, non-numeric, in a wrong format (e.g. ISO date string instead of Unix seconds), or truncated.
Common situations: History entries produced by an older version storing a different timestamp format; passing a human-readable date string from UI state; nil/empty field in history metadata.
Related errors
- attribute view history context is ambiguous
- attribute view rich text style entity was not restored
- attribute view snapshot context is ambiguous
- can not get or create rollback box
- cannot allocate a replacement history directory
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/167f0eea069685db.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_render.go:1231
}
if len(matches) != 1 {
return "", fmt.Errorf("attribute view snapshot context is ambiguous [%s]", avID)
}
boxID := avBoxIDFromRepoPath(matches[0].Path)
if IsEncryptedBox(boxID) {
return boxID, nil
}
return "", nil
}
// ResolveHistoryAttributeViewBoxID 返回历史属性视图的唯一加密笔记本上下文。
func ResolveHistoryAttributeViewBoxID(avID, created string) (string, error) {
if !ast.IsNodeIDPattern(avID) {
return "", ErrInvalidID
}
createdUnix, err := strconv.ParseInt(created, 10, 64)
if err != nil {
return "", fmt.Errorf("parse created [%s] failed: %w", created, err)
}
dirPrefix := time.Unix(createdUnix, 0).Format("2006-01-02-150405")
matches, err := filepath.Glob(filepath.Join(util.HistoryDir, dirPrefix+"*"))
if err != nil {
return "", err
}
var boxIDs []string
for _, historyDir := range matches {
if gulu.File.IsExist(filepath.Join(historyDir, "storage", "av", avID+".json")) {
boxIDs = append(boxIDs, "")
}
entries, _ := os.ReadDir(historyDir)
for _, entry := range entries {
if !entry.IsDir() || !ast.IsNodeIDPattern(entry.Name()) {
continue
}
candidate := filepath.Join(historyDir, entry.Name(), "storage", "av", avID+".json")
if gulu.File.IsExist(candidate) {View on GitHub (pinned to 9f775e8a12)