affaan-m/ECC · error
ErrInvalidInput
ErrInvalidInput
Error message
invalid input
What it means
Sentinel error example in the golang-patterns skill documentation: ErrInvalidInput is the idiomatic Go sentinel for rejected request data, compared with errors.Is. Mirrored in the es and ja-JP translations; documentation code, not a runtime throw site.
Source
Thrown at skills/golang-patterns/SKILL.md:132
### Custom Error Types
```go
// Define domain-specific errors
type ValidationError struct {
Field string
Message string
}
func (e *ValidationError) Error() string {
return fmt.Sprintf("validation failed on %s: %s", e.Field, e.Message)
}
// Sentinel errors for common cases
var (
ErrNotFound = errors.New("resource not found")
ErrUnauthorized = errors.New("unauthorized")
ErrInvalidInput = errors.New("invalid input")
)
```
### Error Checking with errors.Is and errors.As
```go
func HandleError(err error) {
// Check for specific error
if errors.Is(err, sql.ErrNoRows) {
log.Println("No records found")
return
}
// Check for error type
var validationErr *ValidationError
if errors.As(err, &validationErr) {
log.Printf("Validation error on field %s: %s",
validationErr.Field, validationErr.Message)View on GitHub (pinned to 06c5e118c4)
Solutions
- Validate the input against the expected schema before submission; correct malformed or out-of-range fields.
- Log the rejected value at the boundary so the caller can see which field failed validation.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at skills/golang-patterns/SKILL.md:132 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18).
Data as JSON: /api/errors/b06dd1f242327521.
Report an issue: GitHub.