onetimesecret/onetimesecret · error · Onetime::Operations::Email::PreviewTemplate::MissingSampleError
No sample data found: #{path}
Error message
No sample data found: #{path} What it means
Error "No sample data found: #{path}" thrown in onetimesecret/onetimesecret.
Source
Thrown at lib/onetime/operations/email/preview_template.rb:126
@format == 'html'
end
# Mirror the CLI's load_data / load_sample_data exactly so preview output is
# identical whether invoked over HTTP or on a shell.
def resolve_data
if @data
symbolized = @data.transform_keys(&:to_sym)
symbolized[:recipient] ||= 'preview@example.com'
symbolized[:email_address] ||= symbolized[:recipient]
symbolized
else
load_sample_data
end
end
def load_sample_data
sample_file = File.join(SAMPLES_PATH, "#{@template}.yml")
raise MissingSampleError, sample_file unless File.exist?(sample_file)
parsed = YAML.safe_load_file(sample_file, permitted_classes: [Symbol])
symbolized = parsed.transform_keys(&:to_sym)
symbolized[:recipient] ||= symbolized.delete(:email_address) || 'preview@example.com'
symbolized[:email_address] ||= symbolized[:recipient]
symbolized
end
end
end
end
end
View on GitHub (pinned to f81295e41b)
Solutions
- Check that the sample data path exists and is readable; correct the path or provide the missing sample file.
When it happens
Trigger: Thrown at lib/onetime/operations/email/preview_template.rb:126 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of onetimesecret/onetimesecret@f81295e41b (2026-08-23).
Data as JSON: /api/errors/a4c10c877b249139.
Report an issue: GitHub.